PJSIP Invited Auto Answer - NOTIFY Event: talk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I basically agree with the e.g. "Alert Info" in the header of the INVITE,
but I think you're missing one kind of application: call manipulation by
application via PBX (CTI). Here the calls are manipulated via the PBX and
not via the endpoint (terminal) itself. The NOTIFY-Event: talk is then used
to tell the SIP-endpoint it has to answer the phone. In the same way this
NOTIFY is used to put the call on hold so it looks like the terminal
initiated the hold. Via re-INVITE (from PBX) it would be a remote held while
from user perspective it has to be local held. Also the conference is
handled this way.

To complete how it can be done (because we did the same).
I suppose you do not subscribe and so you are working with unsolicited
NOTIFY's. This has been mentioned earlier.
1. Create a new callback handler, e.g.
   static pj_bool_t on_rx_unsolicitedrequest(pjsip_rx_data *rdata)
2. Within this handler, check for NOTIFY message:
    if ( pjsip_method_cmp(&rdata->msg_info.msg->line.req.method,
&pjsip_notify_method) == 0 ) {...}
3. Extract and check the header value using:
pj_str_t hdr_name = pj_str("Event");
hdr = (pjsip_generic_string_hdr*)
pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &hdr_name, NULL);
4. Do NOT forget to respond with 200-OK (except when you get ACK, then
return with PJ_TRUE !!)
  pjsip_endpt_respond_stateless( pjsua_get_pjsip_endpt(),
                                 rdata, PJSIP_SC_OK, NULL,
                                 NULL, NULL);

  BTW: You can maybe do this better as first action in step 2 (so first
check on ACK)
5. Finally register this handle to PJSIP:
  static pjsip_module unsolicited_requests_module;

  memset(&unsolicited_requests_module, 0,
sizeof(unsolicited_requests_module));
  unsolicited_requests_module.id = -1;
  unsolicited_requests_module.priority = PJSIP_MOD_PRIORITY_APPLICATION+1;
  unsolicited_requests_module.on_rx_request = &on_rx_unsolicitedrequest;
  unsolicited_requests_module.name = pj_str("UnsolicitedRequests-Module");
  status =
pjsip_endpt_register_module(pjsip_ua_get_endpt(pjsip_ua_instance()),
&unsolicited_requests_module);

With regards,

Eize
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101109/c280616e/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux