Does anyone know good examples of how to configure the pjsip client to receive messages. I can send messages from the client using:
pjsua_im_send(sip_acc_id, &to, NULL, &msgbody, NULL, NULL);
on any number.
But I do not know what to do to receive messages in an already registered sip account.
Any information would be greatly appreciated.
Note. I can only use pjsip and another library.
Edit: Some new things I found:
http://trac.pjsip.org/repos/ticket/1070
http://www.pjsip.org/release/0.5.4/PJSIP-Dev-Guide.pdf (however, this entire document talks about incoming messages:
16.1.2 Receiving a MESSAGE
Incoming MESSAGE requests outside of any dialogs will be received by the application module. Incoming MESSAGE requests inside the dialog box will be notified of the use of the dialog via the on_tsx_state () dialog callback.
which still does not cover how to handle incoming messages.
http://www.ietf.org/rfc/rfc3261.txt
http://trac.pjsip.org/repos/wiki/SIP_Message_Buffer_Event
Edit2: I was told that the on_pager function needs to be used for this function. Therefore, I tried, but still have not succeeded.
Here is what I did:
app_config->cfg.cb.on_call_state = &on_call_state; app_config->cfg.cb.on_call_media_state = &on_call_media_state; app_config->cfg.cb.on_incoming_call = &on_incoming_call; app_config->cfg.cb.on_reg_state = &on_reg_state; app_config->cfg.cb.on_pager = &on_pager;
And the implementation of on_pager:
static 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) { NSLog(@"**************** on_pager called **********************"); AppDelegate *app = (AppDelegate *)[AppDelegate sharedApplication]; pjsua_call_info ci; pjsua_call_get_info(call_id, &ci); PJ_UNUSED_ARG(call_id); PJ_UNUSED_ARG(to); PJ_UNUSED_ARG(contact); PJ_UNUSED_ARG(mime_type); [app ring];
I expected the application to call on_pager when it receives the message, but that is not the case. on_incoming_call , however, is called.