diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-06-11 18:22:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-06-11 18:22:54 +0000 |
commit | aa434b698389bad9d27904c1dab3e96f91f259a8 (patch) | |
tree | 7689535b9bad3e086c7fd65b68b912335f84e30a /pjsip | |
parent | a299aacc7112e537d37dade67dbba42009725991 (diff) |
Ticket #334: Added on_pager_status2() callback to receive the full SIP message of IM delivery status (thanks Paul Levin)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1363 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 28 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_im.c | 21 |
2 files changed, 47 insertions, 2 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 8c1d5b4a..60965be9 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -798,7 +798,8 @@ typedef struct pjsua_callback /** * Notify application about the delivery status of outgoing pager - * request. + * request. See also on_pager_status2() callback for the version with + * \a pjsip_rx_data in the argument list. * * @param call_id Containts the ID of the call where the IM was * sent, or PJSUA_INVALID_ID if the IM was sent @@ -831,6 +832,31 @@ typedef struct pjsua_callback const pj_str_t *reason); /** + * Notify application about the delivery status of outgoing pager + * request. + * + * @param 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. + * @param to Destination URI. + * @param body Message body. + * @param user_data Arbitrary data that was specified when sending + * IM message. + * @param status Delivery status. + * @param reason Delivery status reason. + * @param rdata The incoming MESSAGE response, or NULL if the + * message transaction fails because of time out + * or transport error. + */ + 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_rx_data *rdata); + + /** * Notify application about typing indication. * * @param call_id Containts the ID of the call where the IM was diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c index 81fed481..46eb0e83 100644 --- a/pjsip/src/pjsua-lib/pjsua_im.c +++ b/pjsip/src/pjsua-lib/pjsua_im.c @@ -352,7 +352,7 @@ static void im_callback(void *token, pjsip_event *e) tsx->status_text.ptr)); } - if (pjsua_var.ua_cfg.cb.on_pager_status) + if (pjsua_var.ua_cfg.cb.on_pager_status) { pjsua_var.ua_cfg.cb.on_pager_status(im_data->call_id, &im_data->to, &im_data->body, @@ -360,6 +360,25 @@ static void im_callback(void *token, pjsip_event *e) (pjsip_status_code) tsx->status_code, &tsx->status_text); + } + + if (pjsua_var.ua_cfg.cb.on_pager_status2) { + pjsip_rx_data *rdata; + + if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) + rdata = e->body.tsx_state.src.rdata; + else + rdata = NULL; + + pjsua_var.ua_cfg.cb.on_pager_status2(im_data->call_id, + &im_data->to, + &im_data->body, + im_data->user_data, + (pjsip_status_code) + tsx->status_code, + &tsx->status_text, + rdata); + } } } |