|
HOME
SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port
FAQ
Documentation
Licensing
Download
Development (Trac)
Projects using pjsip
Mailing List
Open Source Links
About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono <bennylp pjsip.org>
|
|
Home --> Documentations --> PJSIP Reference
#include <pjsua.h>
Detailed Description
This structure describes application callback to receive various event notification from PJSUA-API. All of these callbacks are OPTIONAL, although definitely application would want to implement some of the important callbacks (such as on_incoming_call).
|
Data Fields |
| void(* | on_call_state )(pjsua_call_id call_id, pjsip_event *e) |
| void(* | on_incoming_call )(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata) |
| void(* | on_call_tsx_state )(pjsua_call_id call_id, pjsip_transaction *tsx, pjsip_event *e) |
| void(* | on_call_media_state )(pjsua_call_id call_id) |
| void(* | on_stream_created )(pjsua_call_id call_id, pjmedia_session *sess, unsigned stream_idx, pjmedia_port **p_port) |
| void(* | on_stream_destroyed )(pjsua_call_id call_id, pjmedia_session *sess, unsigned stream_idx) |
| void(* | on_dtmf_digit )(pjsua_call_id call_id, int digit) |
| void(* | on_call_transfer_request )(pjsua_call_id call_id, const pj_str_t *dst, pjsip_status_code *code) |
| void(* | on_call_transfer_status )(pjsua_call_id call_id, int st_code, const pj_str_t *st_text, pj_bool_t final, pj_bool_t *p_cont) |
| void(* | on_call_replace_request )(pjsua_call_id call_id, pjsip_rx_data *rdata, int *st_code, pj_str_t *st_text) |
| void(* | on_call_replaced )(pjsua_call_id old_call_id, pjsua_call_id new_call_id) |
| void(* | on_reg_state )(pjsua_acc_id acc_id) |
| void(* | on_incoming_subscribe )(pjsua_acc_id acc_id, pjsua_srv_pres *srv_pres, pjsua_buddy_id buddy_id, const pj_str_t *from, pjsip_rx_data *rdata, pjsip_status_code *code, pj_str_t *reason, pjsua_msg_data *msg_data) |
| void(* | on_srv_subscribe_state )(pjsua_acc_id acc_id, pjsua_srv_pres *srv_pres, const pj_str_t *remote_uri, pjsip_evsub_state state, pjsip_event *event) |
| void(* | on_buddy_state )(pjsua_buddy_id buddy_id) |
| void(* | on_pager )(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, const pj_str_t *mime_type, const pj_str_t *body) |
| void(* | on_pager2 )(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, const pj_str_t *mime_type, const pj_str_t *body, pjsip_rx_data *rdata, pjsua_acc_id acc_id) |
| void(* | on_pager_status )(pjsua_call_id call_id, const pj_str_t *to, const pj_str_t *body, void *user_data, pjsip_status_code status, const pj_str_t *reason) |
| void(* | on_pager_status2 )(pjsua_call_id call_id, const pj_str_t *to, const pj_str_t *body, void *user_data, pjsip_status_code status, const pj_str_t *reason, pjsip_tx_data *tdata, pjsip_rx_data *rdata, pjsua_acc_id acc_id) |
| void(* | on_typing )(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, pj_bool_t is_typing) |
| void(* | on_typing2 )(pjsua_call_id call_id, const pj_str_t *from, const pj_str_t *to, const pj_str_t *contact, pj_bool_t is_typing, pjsip_rx_data *rdata, pjsua_acc_id acc_id) |
| void(* | on_nat_detect )(const pj_stun_nat_detect_result *res) |
| pjsip_redirect_op(* | on_call_redirected )(pjsua_call_id call_id, const pjsip_uri *target, const pjsip_event *e) |
| void(* | on_mwi_info )(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info) |
Field Documentation
Notify application when invite state has changed. Application may then query the call info to get the detail call states by calling pjsua_call_get_info() function.
- Parameters:
-
| call_id | The call index. |
| e | Event which causes the call state to change. |
Notify application on incoming call.
- Parameters:
-
| acc_id | The account which match the incoming call. |
| call_id | The call id that has just been created for the call. |
| rdata | The incoming INVITE request. |
This is a general notification callback which is called whenever a transaction within the call has changed state. Application can implement this callback for example to monitor the state of outgoing requests, or to answer unhandled incoming requests (such as INFO) with a final response.
- Parameters:
-
| call_id | Call identification. |
| tsx | The transaction which has changed state. |
| e | Transaction event that caused the state change. |
Notify application when media state in the call has changed. Normal application would need to implement this callback, e.g. to connect the call's media to sound device. When ICE is used, this callback will also be called to report ICE negotiation failure.
- Parameters:
-
Notify application when media session is created and before it is registered to the conference bridge. Application may return different media port if it has added media processing port to the stream. This media port then will be added to the conference bridge instead.
- Parameters:
-
| call_id | Call identification. |
| sess | Media session for the call. |
| stream_idx | Stream index in the media session. |
| p_port | On input, it specifies the media port of the stream. Application may modify this pointer to point to different media port to be registered to the conference bridge. |
Notify application when media session has been unregistered from the conference bridge and about to be destroyed.
- Parameters:
-
| call_id | Call identification. |
| sess | Media session for the call. |
| stream_idx | Stream index in the media session. |
Notify application upon incoming DTMF digits.
- Parameters:
-
| call_id | The call index. |
| digit | DTMF ASCII digit. |
Notify application on call being transfered (i.e. REFER is received). Application can decide to accept/reject transfer request by setting the code (default is 202). When this callback is not defined, the default behavior is to accept the transfer.
- Parameters:
-
| call_id | The call index. |
| dst | The destination where the call will be transfered to. |
| code | Status code to be returned for the call transfer request. On input, it contains status code 200. |
Notify application of the status of previously sent call transfer request. Application can monitor the status of the call transfer request, for example to decide whether to terminate existing call.
- Parameters:
-
| call_id | Call ID. |
| st_code | Status progress of the transfer request. |
| st_text | Status progress text. |
| final | If non-zero, no further notification will be reported. The st_code specified in this callback is the final status. |
| p_cont | Initially will be set to non-zero, application can set this to FALSE if it no longer wants to receie further notification (for example, after it hangs up the call). |
Notify application about incoming INVITE with Replaces header. Application may reject the request by setting non-2xx code.
- Parameters:
-
| call_id | The call ID to be replaced. |
| rdata | The incoming INVITE request to replace the call. |
| st_code | Status code to be set by application. Application should only return a final status (200-699). |
| st_text | Optional status text to be set by application. |
Notify application that an existing call has been replaced with a new call. This happens when PJSUA-API receives incoming INVITE request with Replaces header.
After this callback is called, normally PJSUA-API will disconnect old_call_id and establish new_call_id.
- Parameters:
-
| old_call_id | Existing call which to be replaced with the new call. |
| new_call_id | The new call. |
| rdata | The incoming INVITE with Replaces request. |
Notify application when registration status has changed. Application may then query the account info to get the registration details.
- Parameters:
-
Notification when incoming SUBSCRIBE request is received. Application may use this callback to authorize the incoming subscribe request (e.g. ask user permission if the request should be granted).
If this callback is not implemented, all incoming presence subscription requests will be accepted.
If this callback is implemented, application has several choices on what to do with the incoming request:
- it may reject the request immediately by specifying non-200 class final response in the code argument.
- it may immediately accept the request by specifying 200 as the code argument. This is the default value if application doesn't set any value to the code argument. In this case, the library will automatically send NOTIFY request upon returning from this callback.
it may delay the processing of the request, for example to request user permission whether to accept or reject the request. In this case, the application MUST set the code argument to 202, and later calls pjsua_pres_notify() to accept or reject the subscription request.
Any code other than 200 and 202 will be treated as 200.
Application MUST return from this callback immediately (e.g. it must not block in this callback while waiting for user confirmation).
- Parameters:
-
| srv_pres | Server presence subscription instance. If application delays the acceptance of the request, it will need to specify this object when calling pjsua_pres_notify(). |
| acc_id | Account ID most appropriate for this request. |
| buddy_id | ID of the buddy matching the sender of the request, if any, or PJSUA_INVALID_ID if no matching buddy is found. |
| from | The From URI of the request. |
| rdata | The incoming request. |
| code | The status code to respond to the request. The default value is 200. Application may set this to other final status code to accept or reject the request. |
| reason | The reason phrase to respond to the request. |
| msg_data | If the application wants to send additional headers in the response, it can put it in this parameter. |
Notification when server side subscription state has changed. This callback is optional as application normally does not need to do anything to maintain server side presence subscription.
- Parameters:
-
| acc_id | The account ID. |
| srv_pres | Server presence subscription object. |
| remote_uri | Remote URI string. |
| state | New subscription state. |
| event | PJSIP event that triggers the state change. |
Notify application when the buddy state has changed. Application may then query the buddy into to get the details.
- Parameters:
-
Notify application on incoming pager (i.e. MESSAGE request). Argument call_id will be -1 if MESSAGE request is not related to an existing call.
See also on_pager2() callback for the version with pjsip_rx_data passed as one of the argument.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| from | URI of the sender. |
| to | URI of the destination message. |
| contact | The Contact URI of the sender, if present. |
| mime_type | MIME type of the message. |
| body | The message content. |
This is the alternative version of the on_pager() callback with pjsip_rx_data argument.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| from | URI of the sender. |
| to | URI of the destination message. |
| contact | The Contact URI of the sender, if present. |
| mime_type | MIME type of the message. |
| body | The message content. |
| rdata | The incoming MESSAGE request. |
| acc_id | Account ID most suitable for this message. |
Notify application about the delivery status of outgoing pager request. See also on_pager_status2() callback for the version with pjsip_rx_data in the argument list.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| to | Destination URI. |
| body | Message body. |
| user_data | Arbitrary data that was specified when sending IM message. |
| status | Delivery status. |
| reason | Delivery status reason. |
Notify application about the delivery status of outgoing pager request.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| to | Destination URI. |
| body | Message body. |
| user_data | Arbitrary data that was specified when sending IM message. |
| status | Delivery status. |
| reason | Delivery status reason. |
| tdata | The original MESSAGE request. |
| rdata | The incoming MESSAGE response, or NULL if the message transaction fails because of time out or transport error. |
| acc_id | Account ID from this the instant message was send. |
Notify application about typing indication.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| from | URI of the sender. |
| to | URI of the destination message. |
| contact | The Contact URI of the sender, if present. |
| is_typing | Non-zero if peer is typing, or zero if peer has stopped typing a message. |
Notify application about typing indication.
- Parameters:
-
| call_id | Containts the ID of the call where the IM was sent, or PJSUA_INVALID_ID if the IM was sent outside call context. |
| from | URI of the sender. |
| to | URI of the destination message. |
| contact | The Contact URI of the sender, if present. |
| is_typing | Non-zero if peer is typing, or zero if peer has stopped typing a message. |
| rdata | The received request. |
| acc_id | Account ID most suitable for this message. |
Callback when the library has finished performing NAT type detection.
- Parameters:
-
| res | NAT detection result. |
This callback is called when the call is about to resend the INVITE request to the specified target, following the previously received redirection response.
Application may accept the redirection to the specified target (the default behavior if this callback is implemented), reject this target only and make the session continue to try the next target in the list if such target exists, stop the whole redirection process altogether and cause the session to be disconnected, or defer the decision to ask for user confirmation.
This callback is optional. If this callback is not implemented, the default behavior is to NOT follow the redirection response.
- Parameters:
-
| call_id | The call ID. |
| target | The current target to be tried. |
| e | The event that caused this callback to be called. This could be the receipt of 3xx response, or 4xx/5xx response received for the INVITE sent to subsequent targets, or NULL if this callback is called from within pjsua_call_process_redirect() context. |
- Returns:
- Action to be performed for the target. Set this parameter to one of the value below:
- PJSIP_REDIRECT_ACCEPT: immediately accept the redirection (default value). When set, the call will immediately resend INVITE request to the target.
- PJSIP_REDIRECT_REJECT: immediately reject this target. The call will continue retrying with next target if present, or disconnect the call if there is no more target to try.
- PJSIP_REDIRECT_STOP: stop the whole redirection process and immediately disconnect the call. The on_call_state() callback will be called with PJSIP_INV_STATE_DISCONNECTED state immediately after this callback returns.
- PJSIP_REDIRECT_PENDING: set to this value if no decision can be made immediately (for example to request confirmation from user). Application then MUST call pjsua_call_process_redirect() to either accept or reject the redirection upon getting user decision.
This callback is called when a NOTIFY request for message summary / message waiting indication is received.
- Parameters:
-
| acc_id | The account ID. |
| mwi_info | Structure containing details of the event, including the received NOTIFY request in the rdata field. |
The documentation for this struct was generated from the following file:
PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.
|
|