On Tue, Feb 10, 2009 at 11:46 AM, Benny Prijono <bennylp at teluu.com> wrote: > 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 > Hi Benny, that's reasonable but in my case it lacks one matching-attempt. I registered with my username. Then I call my account by using the telephone number I got from my serviceprovider. The SIP- INVITE contains this number + domain in the TO-Field. That's why it isn't matched. But the request-line contains my username, so you could try this one too, before using the default account. Regards, Matthias -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090210/ed7f35ed/attachment.html>