Account id for incoming calls (pjsua unlikes pjsua?)

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

 



Hi,

I made a simple application with two accounts (<sip:x.x.x.x:6060>, <sip:x.x.x.x:6061>). Unfortunately all incoming calls are routed to the first account.
I made some modifications.
In the initialize_acc funtion (pjsua_acc.c) I set the sip srv port:

  acc->display = name_addr->display;
  acc->user_part = sip_uri->user;
  acc->srv_domain = sip_uri->host;
- acc->srv_port = 0;
+ acc->srv_port = sip_uri->port;

  if (sip_reg_uri) {
    acc->srv_port = sip_reg_uri->port;
  }

and in the pjsua_acc_find_for_incoming function (pjsua_acc.c) I put the port checking in the account finder condition:

  if (acc->valid && pj_stricmp(&acc->user_part, &sip_uri->user)==0 &&
-   pj_stricmp(&acc->srv_domain, &sip_uri->host)==0)
+   pj_stricmp(&acc->srv_domain, &sip_uri->host)==0 &&
+   acc->srv_port == sip_uri->port)
  {
    /* Match ! */
    PJSUA_UNLOCK();
    return acc_id;
  }

After these simple modifications the incoming calls are routed to the proper accounts (I used SJPhone to initiating calls) except the accounts call each others:

  pjsua_call_id cid;
  pjsua_call_make_call(0, &pj_str("sip:x.x.x.x:6061"), 0, NULL, NULL, &cid); or
  pjsua_call_make_call(1, &pj_str("sip:x.x.x.x:6060"), 0, NULL, NULL, &cid);

One difference between the two sip clients (pjsua and SJPhone) is that SJPhone sets the port in the "To" SIP header (To: x.x.x.x:port). Maybe pjsua should set it, too.

Could someone consider it is a real bug and my modifications make any sense?

Thanks,
Daniel Nanassy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090529/d99e6b12/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