Skip to main content

Problem with CALLERID in DID Inbound Route

Posted by rmartinez on Fri, 05/14/2010

Hello.
I'm having the next problem. I have configured two tenants for testing purposes. In each tenant there are two extensions registered. So far so good. I also i have created two TRUNK to communicate with a test ITSP. I have the trunks registered in the ITSP proxy.
So, for PBX RV i have the AOR 5501122334
for PBX floyd i have the AOR 5501234567

When i call to the 5501122334 i have an IVR answering the and sending the call to an operator. The operator is in the annex 104 from the RV Tenant. The problem is when i see the call in the annex 104 i see the number from the other trunk as incoming caller id ( 5501234567 ).
What could be te problem?

Here is part of the asterisk debug:

<--- SIP read from UDP://10.0.0.212:5060 --->
INVITE sip:5501122334@10.0.0.197 SIP/2.0
Record-Route:
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bK6005.b566bd6.0
Via: SIP/2.0/UDP 10.0.0.207:5060;branch=z9hG4bK544b9936a4110
From: ;tag=544b9936a4
To:
Call-ID: 545ced4b-3abb-9945-8136-0002a4005672@10.0.0.207
CSeq: 110 INVITE
Supported: timer, replaces
Min-SE: 1800
Date: Fri, 14 May 2010 14:21:08 GMT
User-Agent: AddPac AP2520 8.30V
Contact:
Accept: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO
Content-Type: application/sdp
Content-Length: 286
Max-Forwards: 69
P-hint: outbound->inbound

v=0
o=3341876 1273846868 1273846868 IN IP4 10.0.0.207
s=AddPac Gateway SDP
c=IN IP4 10.0.0.207
t=1273846868 0
m=audio 23202 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

<------------->
--- (19 headers 12 lines) ---
== Using SIP RTP CoS mark 5
== Using SIP VRTP CoS mark 6
== Using UDPTL CoS mark 5
Sending to 10.0.0.212 : 5060 (no NAT)
Using INVITE request as basis request - 545ced4b-3abb-9945-8136-0002a4005672@10.0.0.207
Found peer 'REDVOISS-floyd' for '3341876' from 10.0.0.212:5060
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 18
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0x10c (ulaw|alaw|g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port 10.0.0.207:23202
Looking for 5501122334 in from-outside (domain 10.0.0.197)
list_route: hop:

<--- Transmitting (no NAT) to 10.0.0.212:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bK6005.b566bd6.0;received=10.0.0.212
Via: SIP/2.0/UDP 10.0.0.207:5060;branch=z9hG4bK544b9936a4110
Record-Route:
From: ;tag=544b9936a4
To:
Call-ID: 545ced4b-3abb-9945-8136-0002a4005672@10.0.0.207
CSeq: 110 INVITE
Server: Asterisk PBX 1.6.1.19
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: 1800;refresher=uas
Contact:
Content-Length: 0

<------------>
-- Executing [5501122334@from-outside:1] Wait("SIP/REDVOISS-floyd-00000045", "1") in new stack
-- Executing [5501122334@from-outside:2] Set("SIP/REDVOISS-floyd-00000045", "__INCOMINGCLI=5501234567") in new stack
-- Executing [5501122334@from-outside:3] Goto("SIP/REDVOISS-floyd-00000045", "from-outside-redir,5501122334,1") in new stack
-- Goto (from-outside-redir,5501122334,1)
-- Executing [5501122334@from-outside-redir:1] Set("SIP/REDVOISS-floyd-00000045", "DIALED_PUBLIC_NUMBER=5501122334") in new stack
-- Executing [5501122334@from-outside-redir:2] Set("SIP/REDVOISS-floyd-00000045", "DIALED_NUMBER=5501122334") in new stack
-- Executing [5501122334@from-outside-redir:3] Set("SIP/REDVOISS-floyd-00000045", "status=1") in new stack
-- Executing [5501122334@from-outside-redir:4] GotoIf("SIP/REDVOISS-floyd-00000045", "1?7") in new stack
-- Goto (from-outside-redir,5501122334,7)
-- Executing [5501122334@from-outside-redir:7] GotoIf("SIP/REDVOISS-floyd-00000045", "0?16") in new stack
-- Executing [5501122334@from-outside-redir:8] Set("SIP/REDVOISS-floyd-00000045", "MAXCALLS=1") in new stack
-- Executing [5501122334@from-outside-redir:9] GotoIf("SIP/REDVOISS-floyd-00000045", "0?16") in new stack
-- Executing [5501122334@from-outside-redir:10] Set("SIP/REDVOISS-floyd-00000045", "GROUP(callpaths)=REDVOISS") in new stack
-- Executing [5501122334@from-outside-redir:11] NoOp("SIP/REDVOISS-floyd-00000045", "GROUP_COUNT = 1") in new stack
-- Executing [5501122334@from-outside-redir:12] GotoIf("SIP/REDVOISS-floyd-00000045", "0?13:16") in new stack
-- Goto (from-outside-redir,5501122334,16)
-- Executing [5501122334@from-outside-redir:16] GotoIfTime("SIP/REDVOISS-floyd-00000045", "*,*,*,*?from-outside-5501122334-tl-allhours-REDVOISS,5501122334,1") in new stack
-- Goto (from-outside-5501122334-tl-allhours-REDVOISS,5501122334,1)
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:1] Set("SIP/REDVOISS-floyd-00000045", "__tenant=REDVOISS") in new stack
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:2] Set("SIP/REDVOISS-floyd-00000045", "CDR(userfield)=REDVOISS") in new stack
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:3] Set("SIP/REDVOISS-floyd-00000045", "MOH=default-REDVOISS") in new stack
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:4] GotoIf("SIP/REDVOISS-floyd-00000045", "0?nomoh") in new stack
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:5] Set("SIP/REDVOISS-floyd-00000045", "CHANNEL(musicclass)=default-REDVOISS") in new stack
-- Executing [5501122334@from-outside-5501122334-tl-allhours-REDVOISS:6] Macro("SIP/REDVOISS-floyd-00000045", "tl-menu,tl-main-menu-open-REDVOISS,") in new stack
-- Executing [s@macro-tl-menu:1] Set("SIP/REDVOISS-floyd-00000045", "CALLERID(name)=") in new stack
-- Executing [s@macro-tl-menu:2] Goto("SIP/REDVOISS-floyd-00000045", "tl-main-menu-open-REDVOISS,s,1") in new stack
-- Goto (tl-main-menu-open-REDVOISS,s,1)
== Channel 'SIP/REDVOISS-floyd-00000045' jumping out of macro 'tl-menu'
-- Executing [s@tl-main-menu-open-REDVOISS:1] GotoIf("SIP/REDVOISS-floyd-00000045", "0?start") in new stack
-- Executing [s@tl-main-menu-open-REDVOISS:2] Set("SIP/REDVOISS-floyd-00000045", "TL_LEVEL=1") in new stack
-- Executing [s@tl-main-menu-open-REDVOISS:3] Ringing("SIP/REDVOISS-floyd-00000045", "") in new stack
thirdlane-ng*CLI>

Can someone point me in the right direction?

Thanks in advance
Ricardo.-


Submitted by rmartinez on Mon, 05/17/2010 Permalink

I other words..
I have two trunks with the same host IP address. Different usernames and passwords, but the same IP.
Is there a way to choose one peer or the other ??

Thanks.
Ricardo.-

Submitted by rmartinez on Wed, 05/19/2010 Permalink

So, what would be the best option to have different DID's from the same ITSP?.
To have one SIP INCOMING TRUNK for all the DID's to all my Tenants?
If so, do i need to create a Trunk only for incoming calls?, with or without authentication?.

Con someone give me some guidelines here?

Thanks in advance,
Regards,
Ricardo.-

Submitted by eeman on Wed, 05/19/2010 Permalink

it depends on your carrier and their equipment. Some equipment doesn't use proxy authentication and only concerns itself with IP.

what exactly are you trying to accomplish in the end.. and why? once i know that i can point you in the right direction.

Submitted by rmartinez on Wed, 05/19/2010 Permalink

Hi Erik
Let me see. We're trying to use the Multitenant PBX to deploy a hosted PBX service. We're also the ITSP (carrier) to this service. We need to create several independent PBX for different clients. For each client we need an outgoing trunk for billing purposes. I was thiking in use the same outgoing trunk to receive the incoming calls ( adding a register line in the trunk configuration). In my tests i have created two Tenants, each one with one trunk for inbound/outboud calls, but then i realized that all the incoming calls were entering over the same trunk. This is what i reoprt at the first. I have a SIP proxy sending calls to the PBX, so i was "trusting" i the IP of the proxy to receive the calls. Since all the calls for the different tenants came from the same IP i was starting to see the "problem" of incoming calls entering for the same trunk.
So that's the scenario, i'm asking for an advice on how to solve this issue.

Thanks,
Ricardo.-

Submitted by eeman on Wed, 05/19/2010 Permalink

For each client we need an outgoing trunk for billing purposes

in almost every example of billing software billing a trunk that I've run across, it does this based on the IP. Separate entries in sip.conf wont help if this is the case.

as far as separate trunks for different tenants, if you really have to do this, and you DEFINITELY can support authentication, stop making 'friends'. Separate them into users and peers and set user/pass on everything. A 'user' *must* authenticate, the host= parameter isnt used at all. This is a pretty ugly situation where every tenant will have at least 2 additional sip channels one for inbound to your switch and one for outbound but it will parse your calls correctly.

Submitted by eeman on Wed, 05/19/2010 Permalink

looking at your original post... and for clarification.. the callerid field should ALWAYS be blank on a trunk line. Honestly I don't even know why it asks for it because it only causes people to assume the wrong thing. callerid= in a channel driver simply erases the callerid of inbound calls and replaces it with value X. Unless you want every call to show up as from yourself, thats a bad idea. This is only useful for ip phones where their incomming calls (as in incomming to the pbx from the phone) should have their callerid's set.

Submitted by rmartinez on Wed, 05/19/2010 Permalink

Thanks again Erik.
So, to clarify this issue.
If i have two tenants, for example. And one of my requirements is to have one OUTBOUND trunk per tenant i need to create two trunks pointing to my sip-proxy as "peers" (outbound). So far so good.
Now, for the incoming calls, are you saying that is possible to create one trunk per tenant again?, but using authentication with user/pass instead of trust the IP of my sip-proxy?. Anyway, that's going to be a challenge, since the proxy acts as a UAS and not as a UAC and i don't have where to pick a user/pass to send the call to the Asterisk.
Now if i choose to trust the IP of my proxy to send the incoming calls to all my tenants through one and only INCOMING trunk, Is this a common practice?. In this way i only need to manage the DID's in the "DID" link from the web-admin page to redirect the call to one or other extension. isn't?

Hope you can help me again.
Thanks.
Ricardo.-

Submitted by eeman on Wed, 05/19/2010 Permalink

yes, for example I just have a single trunk in and out of my MTE box. I use other methods to tag my calls like source/destination #'s and account codes.

Submitted by rmartinez on Thu, 05/20/2010 Permalink

Hello.
I'm having problems to match the INCOMING trunk with the incoming call. I'm sending from my sip-proxy the DID's corresponding to each PBX to the MTE box. As i posted recently i have two outgoing trunks... each for every Tenant in the MTE, those are working perfectly. But then i created a third trunk called INCOMING i can't match the incoming call with that trunk. This is the configuration :

[RDVS-rv]
qualify=2000
fromuser=5501122334
nat=no
fromdomain=10.0.0.212
secret=chao
;=description=SIP TRUNK OUT RV (to RDVS)
host=10.0.0.212
username=5501122334
dtmfmode=rfc2833
context=from-outside
type=peer
canreinvite=no
disallow=all
allow=ulaw
allow=alaw

[RDVS-floyd]
qualify=2000
fromuser=5501234567
nat=no
fromdomain=10.0.0.212
secret=hola
;=description=SIP TRUNK OUT FLOYD (to RDVS)
host=10.0.0.212
username=5501234567
dtmfmode=rfc2833
context=from-outside
type=peer
canreinvite=no
disallow=all
allow=ulaw
allow=alaw

[INCOMING]
qualify=2000
nat=no
;=description=INCOMING DID's from RDVS
host=10.0.0.212
dtmfmode=rfc2833
context=from-outside
type=user
insecure=port,invite
canreinvite=no
disallow=all
allow=ulaw
allow=alaw

and this is the incoming call (matching an OUTGOING trunk... why?)

thirdlane-ng*CLI>
<--- SIP read from UDP://10.0.0.212:5060 --->
INVITE sip:5501234567@10.0.0.197 SIP/2.0
Record-Route:
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bKc5fb.ea0f2cf6.0
Via: SIP/2.0/UDP 10.0.0.207:5060;branch=z9hG4bK8f4b4537a48
From: ;tag=8f4b4537a4
To:
Call-ID: 8f38f54b-c94d-453c-8037-0002a4005672@10.0.0.207
CSeq: 8 INVITE
Supported: timer, replaces
Min-SE: 1800
Date: Thu, 20 May 2010 13:26:39 GMT
User-Agent: AddPac AP2520 8.30V
Contact:
Accept: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO
Content-Type: application/sdp
Content-Length: 286
Max-Forwards: 69
P-hint: outbound->inbound
P-hint: to_pbx_trunk

v=0
o=3341876 1274361999 1274361999 IN IP4 10.0.0.207
s=AddPac Gateway SDP
c=IN IP4 10.0.0.207
t=1274361999 0
m=audio 23084 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

<------------->
--- (20 headers 12 lines) ---
== Using SIP RTP CoS mark 5
== Using SIP VRTP CoS mark 6
== Using UDPTL CoS mark 5
Sending to 10.0.0.212 : 5060 (no NAT)
Using INVITE request as basis request - 8f38f54b-c94d-453c-8037-0002a4005672@10.0.0.207
Found peer 'RDVS-rv' for '3341876' from 10.0.0.212:5060

<--- Reliably Transmitting (no NAT) to 10.0.0.212:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bKc5fb.ea0f2cf6.0;received=10.0.0.212
Via: SIP/2.0/UDP 10.0.0.207:5060;branch=z9hG4bK8f4b4537a48
From: ;tag=8f4b4537a4
To: ;tag=as3f24743d
Call-ID: 8f38f54b-c94d-453c-8037-0002a4005672@10.0.0.207
CSeq: 8 INVITE
Server: Asterisk PBX 1.6.1.19
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="50456643"
Content-Length: 0

Thanks.
Ricardo.-

Submitted by eeman on Thu, 05/20/2010 Permalink

your inbound trunk is setup wrong

get rid of the host= and insecure=

you need to asign a username/password

also get rid of fromuser in your trunk... you should be fine using dialplan CALLERID settings.

fromuser overrides callerid

Submitted by rmartinez on Thu, 05/20/2010 Permalink

in the inbound trunk i removed the host and insecure..
and added
username=user
secret=mysecretpassword

the incoming call is still matching the outbonud trunks........

SIP Debugging enabled
thirdlane-ng*CLI>
<--- SIP read from UDP://10.0.0.212:5060 --->
INVITE sip:5501333333@10.0.0.197 SIP/2.0
Record-Route:
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bK7f69.f7ee6953.0
Via: SIP/2.0/UDP 10.0.0.220:5060;branch=z9hG4bKff4b4a0da48
From: ;tag=ff4b4a0da4
To:
Call-ID: ff3bf54b-f54f-4a0b-800d-0002a4011992@10.0.0.220
CSeq: 8 INVITE
Supported: timer, replaces, early-session
Min-SE: 1800
Date: Thu, 20 May 2010 13:41:19 GMT
User-Agent: AddPac SIP Gateway
Contact:
Accept: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, UPDATE, REFER, NOTIFY, INFO
Content-Type: application/sdp
Content-Length: 289
Max-Forwards: 69
P-hint: inbound->inbound
P-hint: to_pbx_trunk

v=0
o=5504444444 1274362879 1274362879 IN IP4 10.0.0.220
s=AddPac Gateway SDP
c=IN IP4 10.0.0.220
t=1274362879 0
m=audio 23008 RTP/AVP 4 18 0 101
a=rtpmap:4 G723/8000
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20

<------------->
--- (20 headers 12 lines) ---
== Using SIP RTP CoS mark 5
== Using SIP VRTP CoS mark 6
== Using UDPTL CoS mark 5
Sending to 10.0.0.212 : 5060 (no NAT)
Using INVITE request as basis request - ff3bf54b-f54f-4a0b-800d-0002a4011992@10.0.0.220
Found peer 'RDVS-rv' for '5504444444' from 10.0.0.212:5060

<--- Reliably Transmitting (no NAT) to 10.0.0.212:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.0.0.212;branch=z9hG4bK7f69.f7ee6953.0;received=10.0.0.212
Via: SIP/2.0/UDP 10.0.0.220:5060;branch=z9hG4bKff4b4a0da48
From: ;tag=ff4b4a0da4
To: ;tag=as7dbf3145
Call-ID: ff3bf54b-f54f-4a0b-800d-0002a4011992@10.0.0.220
CSeq: 8 INVITE
Server: Asterisk PBX 1.6.1.19
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="249ab3d8"
Content-Length: 0

It has something to do with this that my sip-proxy (10.0.0.212) is the INCOMING and OUTGOING trunk?

Ricardo.-

Submitted by eeman on Thu, 05/20/2010 Permalink

well first you still need to remove fromuser because thats overriding your callerid. Are you sure inbound calls are not authenticating with the username/pass of RDVS-rv?

Submitted by rmartinez on Thu, 05/20/2010 Permalink

The RDVS-rv and RDVS-floyd are two OUTBOUND trunks.... what i'm looking for is the incoming call show in the last post match the INBOUND trunk called "INCOMING", but keep matching the trunk [RDVS-rv]
The outbound calls are working fine for my tenants... the problem is with the INBOUND calls...

Regards,
Ricardo.-

Submitted by eeman on Fri, 05/21/2010 Permalink

if your provider is sending 5501122334/chao as a user/pass then yes, its going to match the wrong trunk.

are you SURE that they are authenticating as the user/pass of the trunk you called INCOMING ?

Submitted by rmartinez on Mon, 05/24/2010 Permalink

Hello Erik.
Sorry for the late responde, the last friday was holyday here in my country.
First.
My provider is sending an INVITE to thr RURI : sip:5501333333. The From is : sip:5504444444, notice that this is the first INVITE, without any password, and this INVITE is matching the [RDVS-rv] (outbound) trunk in the MTE. How can i force the incoming INVITE to match the correct trunk [INCOMING].

Thanks.
Ricardo.-