Asterisk Username Mismatch Workaround

Posted by marco
Thu, 25 Oct 2007 00:10:00 GMT

I installed recently AsteriskNow beta6, that is a rpath based Linux distribution, which contains Asterisk 1.4.9 and AsteriskGUI.

While I was trying to use with a SNOM phone (which, by the way, is a great product) with two identies configured on it, say 101 and 103, I stumbled on a problem well known on the web.

If I try to use an identity calling out, everything is working fine; while if I try to use the other identity, I obtain the following error:

   WARNING[32233]: chan_sip.c:8126 check_auth: username mismatch, have <101>, digest has <103>

The users 101 and 103 are created with the GUI. If you look in /etc/asterisk/users.conf you will find something like this:

   [101]
   callwaiting = yes
   cid_number = 
   context = numberplan-custom-1
   fullname = 101
   hasagent = no
   hasdirectory = no
   hasiax = no
   hasmanager = no
   hassip = yes
   hasvoicemail = yes
   host = dynamic
   mailbox = 101
   secret = xxx
   threewaycalling = yes
   vmsecret = xxx
   registersip = yes 
   canreinvite = yes
   nat = no
   dtmfmode = rfc2833
   disallow = all
   allow = ulaw,alaw

   [103]
   callwaiting = yesWorkaround
   cid_number = 
   context = numberplan-custom-1
   fullname = 103
   hasagent = no
   hasdirectory = no
   hasiax = no
   hasmanager = no
   hassip = yes
   hasvoicemail = yes
   host = dynamic
   mailbox = 103
   secret = xxx
   threewaycalling = yes
   vmsecret = xxx
   registersip = yes 
   canreinvite = yes
   nat = no
   dtmfmode = rfc2833
   disallow = all
   allow = ulaw,alaw

Workaround

I solved the problem, at least in my installation, using a workaround. I just copied and adapted the above definitions in the file /etc/asterik/sip.conf. This file is not touched by the GUI, so you can edit it safely. Just remember to modify it if you modify the users definition with the GUI, in order to reflect the variations of users.conf. The relevant part of sip.conf looks like:

  [101]
  type = friend;
  context = numberplan-custom-1;
  secret = xxx
  host = dynamic ;
  dtmfmode = rfc2833;
  disallow = all
  allow = ulaw,alaw;
  canreinvite = yes

  [103]
  type = friend;
  context = numberplan-custom-1;
  secret = xxx
  host = dynamic ;
  dtmfmode = rfc2833;
  disallow = all
  allow = ulaw,alaw;
  canreinvite = yes

Well, it seems to work.