Asterisk : Display Caller ID of original caller when an IAX Trunk is set - asterisk

Friendly greetings, everyone !
I set up two Asterisk boxes : one with 2000 to 2999 extensions, the other with 5000 to 5999 extensions. On both, I have SIP users : 2005 and 2025 on one, 5002 and 5025 on the other.
I set up an IAX trunk between the two, using Asterisk-GUI : on my trunks, the user's extensions are 2999 and 5999. The trunks are registered, everything is OK on this matter.
Let's say user SIP 2005 (on one side) wants to call user SIP 5002 (on the other side). I make the call, the call is normally relayed (I can join the other side) but, on 5002's phone, the displayed Caller ID is "2999" (trunk ID), which is bothersome.
Is there a way to keep the original Caller ID (so, in my example, 2005) and display it on 5002's phone ?
I consulted Asterisk's doc and voip-info.org, but I haven't found my answer as of yet.

That mean you trunk have callerid= or fromuser= in definition. If you remove it, will be original callerid.
Also please note, you should use dial command with "o" flag when calling trunk.
o([x]): If <x> is not provided, specify that the CallerID that was
present on the *calling* channel be stored as the CallerID on the *called*
channel. This was the behavior of Asterisk 1.0 and earlier. If <x> is
provided, specify the CallerID stored on the *called* channel. Note that
o(${CALLERID(all)}) is similar to option o without the parameter.

Not sure which version of Asterisk your using but you need to set the caller id in the dial plan. That way you can send whatever you like rather than being fixed to sending 1 caller ID for any call on that trunk.
In extensions.conf you should have something like this (taken from my conf)
[to_hq]
exten => _7900.,1,Set(CALLERID(num)=7000${CALLERID(num)})
exten => _7900.,2,Dial(IAX2/to_hq/${EXTEN:4})
In my config I dial 7900 to access the iax trunk then the remote ext I'm trying to reach. The caller id sends and displays on the remote phone as 7000xxxx where xxxx=the local ext I'm calling from.
7000 in my config is my local trunk code so that when I call a remote user they can call me back without having to dial the routing code.
The other side of the config on the remote node would look like this;
[to_me]
exten => _7000.,1,Set(CALLERID(num)=7900${CALLERID(num)})
exten => _7000.,2,Dial(IAX2/to_me/${EXTEN:4})

Related

Replacing dialplan with ARI for "dynamic" inbound extensions

I'm experimenting with the ARI interface in Asterisk (v15.5). I've managed to placing and manage outbound calls relatively well, and I'm now trying to tackle inbound calls.
I don't have any dialplan to speak of on my test server; it hasn't been needed: I just connect via ARI, Originate channels, and bridge them together. However, trying to send an inbound call to the server gives me an error
chan_sip.c:26513 handle_request_invite: Call from 'upstreamserver' (192.168.x.x:5060) to extension '12345' rejected because extension not found in context 'default'.
Fair enough - Asterisk doesn't know about extension 12345 or what to do with it. I could, of course, add this into extensions.conf, put the extension into stasis and let my application deal with this: however, this has two downsides:
We have potentially hundreds of inbound numbers, and we'd need to keep the dialplan up to date
We'd like to have multiple ARI applications connecting to the server: it seems we need to specify a specific application name for each extension
Ideally, I'd like to use ARI to programatically tell Asterisk: hey Asterisk, I'm an ARI application, let me know if there's any calls for extension 12345, and I'll take care of those for you. Is there currently a way to do this, or is it back to editing the dialplan and pointing it to my app by hand?
If you want control all via ARI you should do something like this
[default]
exten => _.,1,Noop(need ban this <${CHANNEL(recvip)}>);use fail2ban
exten => h,1,Hangup
[from-trunk]
exten => _.,1,Stasis()
exten => h,1,Hangup
You should not use default context in your peers/extensions
You also can use dynamic realtime and fastagi for control dialplan.

Asterisk ringback tone recording

I made an outbound-call service application using Asterisk AMI interface.
Following is how my application works.
I generate an Originate request to internal channel using TCP/IP socket.
my dialplan accepts the request and run dial command. extension.conf file is
[from-internal]
exten => _X.,1,NoOP()
same => n,MixMonitor(${DialMonitorFile}.wav)
same => n,Dial(PJSIP/${EXTEN}#TRUNK_100-1234-5678,30)
What I want to do is record whole call process (from ringback tone sound until user hangup).
But, when dial started, only 44 byte size file is generated (maybe wav file header?) before user accepts the call. And, file increased after user accepts call.
Can someone help me how can I record ringback tone sound as well ?
Regards,
Brian
You should do Answer before MixMonitor if you want that
Please note, CDRs will be affected

How to route call from VoiceBlue Next device to Asterisk Server

I want to setup and IVR Menu i mean if a user calls to a particular GSM Number then the number should be redirected to Asterisk Server and the user needs to Get IVR Menu
I am using VoiceBlue Next firmware version 1.31.1.34.1 inserted working SIM Card
If i make a call to that particular number i am able to accept call,reject call and other options from VoiceBlueNext Web Interface.
I have made a SIP account in pjsip.conf file and created and extension as 100 in extensions.conf but unable to transfer the call to Asterisk Server
In asterisk server are there any other files to be changed or any settings in VoiceBlue Next
There are not many details to understand your scenario, I have not used VoiceBlue but on Asterisk if you want to receive calls, from your VoiceBlue or any other provider. You have to do two things, one you have to register this peer to allow receive calls, or you can also set allowguest=yes(but very dangerous anyone can send you calls) or add peers at end of pjsip.conf file as little secure way.
Next, you need to add dialplan, suppose if you get any number _X will be any number, now you can put Dial your extension to receive any number from the provider.
As for sip client to call out you have to register peer and both must be in the same context.
Sending outgoing calls, now if you call any number beginning 6 and 7 they will be forwarded to VoiceBlue
exten=>_6XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
exten=>_7XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
for incoming please add following in your pjsip.conf
[VoiceBlueNext]
type=peer
host=10.0.0.20
username=voiceblue
secret=password
fromdomain=10.0.0.20
and in same file on top put following general section
[general]
port = 5060
bindaddr = 0.0.0.0
allowgues=no
context = sip
disallow=all
allow=ulaw
Notice I allowguest = no , so you must provide peer VoiceBlue peer information to receive calls, but if you want to test, make it yes and you will get calls without any security.

Testing Asterisk SIP and DAHDI local calls

I am a real beginner in asterisk, so please tolerate my question :)
I tried to configure asterisk for realtime and it is working fine for local sip calls. Now, I am trying to make the following test with dahdi calls:
I connected an analog phone to an FXS channel of my Digium card and tried to call this phone (exten 124) from a sip softphone (X-lite).
I get the following error:
-- Executing [124#from-sip:1] Dial("SIP/2000-00000004", "SIP/124")
[May 31 10:24:22] WARNING[5457]: chan_sip.c:5667 create_addr: Purely numeric hostname (124), and not a peer--rejecting
my extensions.conf:
[from-sip]
switch =>Realtime
[from-pstn]
exten => 124,1,Dial(DAHDI/3)
It seems that the dial is done using from-sip context not from-pstn context as required.
Anyone to advise or correct my understanding?
Thanks million
Zak
In Asterisk realtime and not realtime you can configure where to send calls from particular extension, this should be configured in "context"(for realtime check context column), so I believe in your case it is "from-sip". This means all calls from that extension will hit this context, you can't send one call from same extension to one context and other to another, all calls will hit "from-sip" context.

channel originate, how to do call from a local channel? (call intercom and send dtmf)

My goal is to :
run a background task activated by dynamic feature while in active call, that will execute dial to another EXT and send DTMF.
It means, when a user is active call with someone, when the user press 5555, the door will be opened.
In order to open the door today, I have to manually call EXT 6(the door) and send DTMF digits: 00*
All of this has to happen automatically when the user press 5555 without interfering the active call.
I tried before to do all of this with dial, but dial blocks the call or bridges with another extension and then I lose the original call.
I figured out that I need to do this with ASYNC, means I can not use dialplan, I need to use CLI, and then originate some how.
Asterisk will need to create a local session / local channel and establish/connect to the door extension, then send DTMF and hangup
All of this – in background.
this is somthing i managed to do so far:
features_applicationmap_custom.conf
openthedoor=> 5555,caller,macro,OpenIntercomCall
then in ->
extensions_custom.conf
[macro-OpenIntercomCall]
exten => s,1,System(asterisk -rx "channel originate SIP/6 extension#yoyo")
i do not understand how do i call to SIP/6 from asterisk(using a local or random channel), and then send DTMF on answer.
the door ext is SIP/6, and 00* is the dtmf to open it.
What i am trying to do is that when a user 5555 in a call, the door will be opened.
means i want asterisk to call the intercom and send dtmf
There are no any sence do exec asterisk from inside asterisk. You can do Originate command.
Originate(tech_data,type,arg1[,arg2[,arg3[,timeout]]])
For example you can do something like this
exten => s,1,Originate(SIP/6,app,SendDTMF,ww00*)
Should be enought for your need.

Resources