• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3064
  • Last Modified:

Asterisk - incoming caller id

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
Marius Kaizerman
Asked:
Marius Kaizerman
  • 5
  • 5
1 Solution
 
PhonebuffCommented:
@Marius.

    What ISO did you build from,  FreePBX version and what phones are you using ?
0
 
Marius KaizermanITAuthor Commented:
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
 
grbladesCommented:
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
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
Marius KaizermanITAuthor Commented:
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
 
grbladesCommented:
You are setting CALLERID(name) but you should be setting CALLERID(number)
0
 
Marius KaizermanITAuthor Commented:
Hi,

How can I fix that ?

Thanks,
Marius.
0
 
grbladesCommented:
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
 
Marius KaizermanITAuthor Commented:
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
 
grbladesCommented:
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
 
Marius KaizermanITAuthor Commented:
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
 
grbladesCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now