[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Asterisk - incoming caller id

Posted on 2012-09-09
11
Medium Priority
?
2,562 Views
Last Modified: 2014-06-01
Hi,

Running Asterisk 1.8.11, two trunks connected.
When receiveing calls, the caller id shown is the trunk's DID number, and not the
real caller number.

The provider says that he sends the caller id information in the sip header, and when looking at the console while receiving a call, I can see it there.

The question is - how can I get the caller id from the sip header and make it appear on the extensions, as it should be ?

Thanks,
Marius.
0
Comment
Question by:Marius Kaizerman
  • 5
  • 5
11 Comments
 
LVL 15

Expert Comment

by:Phonebuff
ID: 38381698
@Marius.

    What ISO did you build from,  FreePBX version and what phones are you using ?
0
 

Author Comment

by:Marius Kaizerman
ID: 38381916
Hi,

The ISO is AsteriskNow 2.0.2 32bit, FreePBX 2.10.0rc1-1 and Cisco 504G phones (although it's the same issue with softphones either).

What I need is a way to get the caller id info from the sip header and and set it to whatever extension is getting the call.

Thanks.
0
 
LVL 36

Expert Comment

by:grblades
ID: 38382167
If you can see the callerid on the console then there must be a dialplan error causing it to be overridden. Or maybe what you are seeing is not actually the callerid.
Can you capture the SIP INVITE header. The callerid can be provided in the FROM header but also in the Remote-Party-ID or the P-Asserted-ID header. If either of these additional headers are provided you can get asterisk to recognize and trust them.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Marius Kaizerman
ID: 38402189
Hi,

Thanks for the answer and sorry for the delay in my reply, I wanted to do some research in order to supply enough information.

So, here's my findings:

On an INCOMING call, this is the what I see (only the relevant part showed):

Executing [s@custom-get-did-from-header:1] Goto("SIP/call-out-00000a92", "from-trunk,73862,1") in new stack
    -- Goto (from-trunk,73862,1)
    -- Executing [73862@from-trunk:1] Set("SIP/call-out-00000a92", "__FROM_DID=73862") in new stack
    -- Executing [73862@from-trunk:2] Gosub("SIP/call-out-00000a92", "app-blacklist-check,s,1()") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("SIP/call-out-00000a92", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Set("SIP/call-out-00000a92", "CALLED_BLACKLIST=1") in new stack
    -- Executing [s@app-blacklist-check:3] Return("SIP/call-out-00000a92", "") in new stack
    -- Executing [73862@from-trunk:3] Set("SIP/call-out-00000a92", "__REC_POLICY_MODE=always") in new stack
    -- Executing [73862@from-trunk:4] Set("SIP/call-out-00000a92", "CDR(did)=73862") in new stack
    -- Executing [73862@from-trunk:5] ExecIf("SIP/call-out-00000a92", "1 ?Set(CALLERID(name)=XYXYXYXYXYXY)") in new stack

If you'll look at the last line - XYXYXYXYXYXY (which I changed from the real phone number) represents the CALLER ID, and this number is shown, no matter who calls in. This is of course not the real caller id of the caller, but the MY phone number.

When activating SIP DEBUG, I also see the headers, and here lies the REAL caller id of the caller:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 1.2.2.1;branch=z9hG4bK174a.81214903.0;received=1.2.2.1;rport=5060
Via: SIP/2.0/UDP 1.2.2.1:5060;branch=z9hG4bK4a5fb90c;rport=5060
Record-Route: <sip:1.2.2.1;lr=on;ftag=as01f8b69e>
From: "+123456789" <sip:+123456789@sip.provider.com>;tag=as01f8b69e
To: <sip:73862@1.2.2.1>;tag=as2e44bb48
Call-ID: 19960d8b578c715a17895bdc089c631e@sip.provider.com
CSeq: 102 INVITE
erver: FPBX-2.10.0rc1(1.8.11)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:s@10.0.11.2:5060>
Content-Type: application/sdp
Content-Length: 258

If you'll look at the line beginning with "FROM", the number "123456789" (which I've changed from the real number) is the REAL caller id.

My question is how can I see the number in this field as caller id ?

Thanks,
Marius/
0
 
LVL 36

Expert Comment

by:grblades
ID: 38402218
You are setting CALLERID(name) but you should be setting CALLERID(number)
0
 

Author Comment

by:Marius Kaizerman
ID: 38402222
Hi,

How can I fix that ?

Thanks,
Marius.
0
 
LVL 36

Expert Comment

by:grblades
ID: 38402230
The correct callerid should be set automatically when he call comes in. Have you tried adding something like the following to the dialplan to help debug.
Noop(callerid is ${CALLERID(number)})

You might also wish to ask your provider if hey support the remote-party-id sip header as you can then set trustrpid= in sip.conf to get asterisk to accept it. It works better for transferring the callerid name, number, and presentation.
0
 

Author Comment

by:Marius Kaizerman
ID: 38402252
I've just tried:
Noop(callerid is ${CALLERID(number)})

And now I'm getting in addition to the name also this line:
-- Executing [s@macro-user-callerid:25] Set("SIP/call-out-00000000", "CALLERID(number)=XYXYXYXYXY") in new stack

the XYXYXYXYXY which represents the caller id is still my number and NOT the the real caller number. It is the same number shown in the CALLERID(name) field.


Regarding the remote-party-id - yes, they do support it.
And I do have trustrpid=yes and sendrpid=yes in sip.conf, but it's not helping.
0
 
LVL 36

Expert Comment

by:grblades
ID: 38402261
Can you post the contents of sip.conf for the trunk link (remove any passwords). You need to make sure the callerid is not specified there.
0
 

Author Comment

by:Marius Kaizerman
ID: 38402300
Two trunks:

[call-out]  
disallow=all
type=peer        
username=removed      
fromuser=removed    
secret=removed
host=sip.provider.com
port=6060
context=custom-get-did-from-header
;context=from-trunk
qualify=yes
insecure=invite,port
allow=g729    
trustrpid=yes        
sendrpid=yes

[call-out_copy_2]
disallow=all
username=removed
type=friend
secret=removed
port=6060
insecure=invite,port
host=sip.provider.com
fromuser=removed
allow=g729
qualify=yes
trusrpid=yes
sendrpid=yes
context=from-trunk-sip-call-out_copy_2
0
 
LVL 36

Accepted Solution

by:
grblades earned 2000 total points
ID: 38402314
Your sip.conf looks ok.

>I've just tried:
>Noop(callerid is ${CALLERID(number)})
>
>And now I'm getting in addition to the name also this line:
>-- Executing [s@macro-user-callerid:25] Set("SIP/call-out-00000000", >"CALLERID(number)=XYXYXYXYXY") in new stack

Looks like you have added an additional Set command and not the NoOp command. Can you put the noop command early in the dialplan and post the complete output when you make a test call (changing the actual numbers is ok but dont omit any lines).

I am off for the night but I will take a look in the morning (UK time).
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Zaptel people (www.zaptel.com) got kind of annoyed with the fact that they were getting bombarded with searches for the zaptel driver system for Asterisk (not to mention they own the trademark on zaptel). So, they kindly requested that Digium ch…
Why do some people recommend buying business VoIP from an ISP? What are the benefits to my company? What are the costs?
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month20 days, 13 hours left to enroll

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question