Group PJSIP_TRANSPORT_LOOP
- group PJSIP_TRANSPORT_LOOP
Loopback transport (for testing purposes).
The loopback transport simply bounce back outgoing messages as incoming messages. This feature is used mostly during automated testing, to provide controlled behavior.
Functions
-
pj_status_t pjsip_loop_start(pjsip_endpoint *endpt, pjsip_transport **transport)
Create and start datagram loop transport.
- Parameters:
endpt – The endpoint instance.
transport – Pointer to receive the transport instance.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_set_discard(pjsip_transport *tp, pj_bool_t discard, pj_bool_t *prev_value)
Enable/disable flag to discard any packets sent using the specified loop transport.
- Parameters:
tp – The loop transport.
discard – If non-zero, any outgoing packets will be discarded.
prev_value – Optional argument to receive previous value of the discard flag.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_set_failure(pjsip_transport *tp, int fail_flag, int *prev_value)
Enable/disable flag to simulate network error. When this flag is set, outgoing transmission will return either immediate error or error via callback. If error is to be notified via callback, then the notification will occur after some delay, which is controlled by pjsip_loop_set_delay().
- Parameters:
tp – The loop transport.
fail_flag – If set to 1, the transport will return fail to deliver the message. If delay is zero, failure will occur immediately; otherwise it will be reported in callback. If set to zero, the transport will successfully deliver the packet.
prev_value – Optional argument to receive previous value of the failure flag.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_set_recv_delay(pjsip_transport *tp, unsigned delay, unsigned *prev_value)
Set delay (in miliseconds) before packet is received by the other end of the loop transport. This will also control the delay for error notification callback.
- Parameters:
tp – The loop transport.
delay – Delay, in miliseconds.
prev_value – Optional argument to receive previous value of the delay.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_set_send_callback_delay(pjsip_transport *tp, unsigned delay, unsigned *prev_value)
Set delay (in miliseconds) before send notification is delivered to sender. This will also control the delay for error notification callback.
- Parameters:
tp – The loop transport.
delay – Delay, in miliseconds.
prev_value – Optional argument to receive previous value of the delay.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_set_delay(pjsip_transport *tp, unsigned delay)
Set both receive and send notification delay.
- Parameters:
tp – The loop transport.
delay – Delay, in miliseconds.
- Returns:
PJ_SUCCESS on success.
-
pj_status_t pjsip_loop_start(pjsip_endpoint *endpt, pjsip_transport **transport)