Skip to main content

Problem with calls between tenants: username mismatch

Posted by jesperkjeldsen on Wed, 10/14/2009

Hi!

I have trouble with calls between two tenants (i use MTE). The calls is routed to our SIP provider and back, but the call gets busy signal.
I get this error in Asterisk:

[Oct 14 16:42:48] WARNING[28230]: chan_sip.c:8743 check_auth: username mismatch, have <96950000>, digest has
[Oct 14 16:42:48] NOTICE[28230]: chan_sip.c:14654 handle_request_invite: Failed to authenticate user "96950000" ;tag=as5ac1aeaf
-- Got SIP response 486 "Busy Here" back from 94.231.97.7
-- SIP/96950000-0984fea0 is busy

In sip.conf I have put insecure=port,invite, but it dosn't change anything. Other calls in and out from both tenants works fine.

Can anyone helt a step further?

Regards
Jesper


Submitted by jesperkjeldsen on Wed, 10/14/2009 Permalink

I have worked on this for days - and now I tried to write "type=peer" in the other options. It changed the direction from inbound/outbound to outbound.

It seems like i work now, but why is my inbound calls also still working?!?

All my trunks uses registration.

Regards Jesper

Submitted by eeman on Thu, 10/15/2009 Permalink

because port,invite only work on peers not users. by making it a peer only, inbound calls from that ip will match against that host= ip address. wouldn't you prefer not to send a tenant-to-tenant call all the way to a provider and then back? Seems like your paying twice the metered rate when this happens.

Submitted by jesperkjeldsen on Thu, 10/15/2009 Permalink

Hi

Thanks for the answer. My stubbornnes (if thats a word ;-)) made me read alot about it last night! So I cam to the same "conclusion" at the end :-)

I would love to keep the calls local, just haven't got time to figure that one out yet. But you are more than welcome to tell me how to do it :-)

Regards

Jesper

Submitted by Had on Thu, 10/15/2009 Permalink

you can create loopback sip trunk. that means trunk from MTE to MTE. Use IP 127.0.0.1 for that. Then you can send all calls between tenants to this trunk. I tried it, works fine.

Another option is some SIP gateway (could be another asterisk box) and route calls back to MTE...

Peter

Submitted by jesperkjeldsen on Tue, 10/20/2009 Permalink

Hi again

If I do the loopback trick, how do I define which calls that should be local?

There must be more out there with MTE that would appreciate a guide/best practice how to do it :-)

I have 10 tenants today where I think the only "local" calls there is is when we call our costumers and they call us - and thats not alot. But of course it will be more and for bandwidth too it would be better to keep them local.

Regards

Jesper

Submitted by Had on Tue, 10/20/2009 Permalink

if you use loopback trunk you can setup outbound routed with Dial Out (2 trunks) script and send all calls to loopback trunk first and then to external trunk. When the call get back to TL it will check all DID, if there is no match it will get back and dial out with second trunk - external.

Submitted by eeman on Tue, 10/20/2009 Permalink

that only works if your DID's match the dialing pattern.. if your DID's are 10 digit and you sent it out as 7 digits it obviously wont match. likewise if you send calls 10 digits but setup your did's as +1NXXNXXXXXX it obviously wont work.

Submitted by jesperkjeldsen on Wed, 10/21/2009 Permalink

Ahhh - thats easy! All out numbers are formated the same way :-)

I just have to do a little scripting I think. I use the extension custom tag to choose the trunk the extensions dial out, so I have to change it to have to trunks in stead of one. But that should be able - even for a newbie as me :-)

Regards and thanks :-)

Jesper

Submitted by dozment on Thu, 10/22/2009 Permalink

We have created a new outbound route that takes care of local calls. We created a new mysql table that is nothing more than a list of DIDs that are defined in MTE. We have a cron job that runs every hour or so to pick up new DIDs from dids.txt (I think that's the name). Then, we use this script in MTE for outbound calls. Before a call goes out we query the DID table to see if it is a local DID. If so, the call gets redirected as if it is an inbound call.

I didn't write the script. If anyone has questions about it I will pass them on to my developer. I've been meaning to post it for some time, but just never had the time.

exten => s,1,MYSQL(Connect ......)

exten => s,2,GotoIf($[${connid} = 0]?9)

exten => s,3,MYSQL(Query resultid ${connid} SELECT\ 'did'\ from\ 'did'\ where\ 'did'\ like\ "%${MACRO_EXTEN:1}"\)

exten => s,4,MYSQL(Fetch fetchid ${resultid} varDID)

exten => s,5,GotoIf($[${fetchid} = 0]?10:6)

exten => s,6,MYSQL(Clear ${resultid})

exten => s,7,MYSQL(Disconnect ${connid})

exten => s,8,Set(_ONNET=1)

exten => s,9,Goto(from-outside-redir,${varDID},1)

exten => s,10,MYSQL(Clear ${resultid})

exten => s,n,MYSQL(Disconnect ${connid})

exten => s,n,Set(_ONNET=0)

exten => s,n,GotoIf($["${MACRO_EXTEN}" = "s"]?dial)

exten => s,n,Set(__DIALED_NUMBER=${MACRO_EXTEN})

exten => s,n(dial),Macro(tl-dialout-base,${ARG1},${ARG2},${ARG3},${ARG4},${ARG5})

exten => h,n,MYSQL(Clear ${resultid})

exten => h,n,MYSQL(Disconnect ${connid})

But, having said all that I re-read the entir post, and I like the trunk solution described here. May be easier than what we did.