On Wed, Feb 4, 2009 at 10:45 AM, Matthias Hardt < mhardt at berlinux-solutions.de> wrote: > Hi, > > I have registered two accounts. When I'm calling > one of them, the account-id for the incoming call > is always the account I registered first. > > I'm using pjsip version 1.0.1. So maybe this > is already fixed. If so I'll update my pjsip > installation. > > Right now I'm having a workaround by parsing the > Request-line and matching the user name. > I tried using pjsua_acc_find_for_incoming(), but > it gives me the same account id as the on_call_state > callback which is always the first registered > account. > > Matthias, indeed pjsua_acc_find_for_incoming() is the function to select the account to use for incoming calls. The algorithm to select the account is to match the To URI of the incoming call as follows: /* Just return default account if To URI is not SIP: */ .. /* Find account which has matching username and domain. */ .. /* No matching account, try match domain part only. */ .. /* No matching account, try match user part (and transport type) only. */ .. /* Still no match, use default account */ I think that's quite a reasonable algo to get the correct account, so I wonder why it didn't get it in your case. cheers Benny -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090210/705f7aff/attachment-0001.html>