How to get provider CallerID, not mine?

When I do - I will write to you so that you realize it. I just wanted to save time. But, as always, in such forums, only primitive answers are known. And when they don’t know, they start making up situations.

Is that meant to mean I’m stupid, or you realized you’ve overlooked something?

I never said that someone is stupid. It annoys and frustrates me that no one understands what I want. And I need to simple GoToIF on the second Asterisk server, if the caller’s number is equal to the number of the provider, but not callers. But I don’t know how I can send this information, from onse server to another via IAX2.

SEE that

I know how can I get this,

and with cut and func exten => s,9,Set(Var_DN=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)}) I got Provider Caller ID

But I dont know how can i save this information and send to IAX2 asterisk,

So what you need is to get the called number passed from Asterisk 1 to Asterisk 2?

In that case it’s available on Asterisk 1 in the to header, it would also be available using CALLERID(DNID) eg:

 same => n,Log(VERBOSE,${CALLERID(DNID)})

You can either replace caller ID’s or dial the same number on Asterisk2 over the IAX link, or put it in a separate header.

But usually you would just use a specific route for the actual inbound number, instead of branching off in the dialplan. That is, replace the gotoif with just exten => 12345678,1,NoOp() where 12345678 is dialed inbound number.

May be this will help

exten => _[+0-9]X.,1,Set(CALLERID(num)=${CUT(CUT(SIP_HEADER(From),@,1),:,2)})

This function is not working. Because, this is Iax2 connection between asterisks. And I got blank info.
Executing [2830@office:1] Log(“IAX2/pbxtors0062-14558”, “VERBOSE,”) in new stack

yes, thank you. But main point - I dont know how send this information to another asterisk via iax2

are u using dial function ?

Can u try this?
u have to set DNID variable


It will can;t works. 'cause
exten => s,40,Dial(${PBX4}1805!${DNID})
The exclamation point will become part of the extention

there is an option that u can pass ur DNID while dialing, i dont remember that, let me check

can u use | instead of !


when u put ! in DIal then can u call that to extension??
then check the dialed extension on otherside incoming dialplan

it doesnt work

Okay, I found it. I found IAXVAR

First server.
exten => s,39,Set(IAXVAR(gameid)=${Var_DN})
exten => s,40,Dial(${PBX4}1805) ; all other channels

Second Server
exten => 2830,1,NoOP(CallerID IS: ${CALLERID(num)})
exten => 2830,n,NoOp(beispiel: ${IAXVAR(gameid)})
exten => 2830,n,GotoIf($[“${IAXVAR(gameid)}” = “55555555555”]?5:4)
exten => 2830,n,Dial(SIP/${EXTEN})
exten => 2830,n,Dial(${TRUNK1}mobilenumber)

I spent a day on this. Now I know this way - it’s valuable. But what prevented you from answering me right away? Your pride.

I assume it’s not working on the receiving Asterisk server.

Just got to remember that changes to the caller ID on the inbound channel, does not get passed through to the outbound channel. You would need to make a pre-dial handler for that purpose. Another option might be passing the o option to Dial. ( See: Asterisk 18 Application_Dial - Asterisk Project - Asterisk Project Wiki )

A pre-dial handler is just a context in the dialplan ending with a call to Return, like so

exten => s,1,NoOp(PredialHandler)
 same => n,NoOp(Here we do predial stuff, like CID)
 same => n,Return()

Whatever variables, including the callerID, you set in that handler, gets set on the outbound channel. See the U option for Dial, and the examples in the docs, for how to actually implement it.

Everything works. Admit it, you just didn’t know it. And where is the change in CallerID? I didn’t change it anywhere, I wasn’t going to change it, and even in the topic there is no word about it.

So stop it. I found answer works for me.

If you look at the timing of your post and mine, there’s about 5 minutes in-between. That means I had NOT read your post when I posted mine.

So why that aggressive tone? It makes no sense being angry and agressive, towards people you’re asking for help solving a problem.

Anyways, glad you found a solution that works for you, have a nice day.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.