Asterisk Refer to new IP address - asterisk

I am having an issue/trying to make something work within Asterisk. I have a trunk to an Ascom Nurse call system and there is a basic function to dial from a handheld device into a patient room. I am able to establish the call from Asterisk to the nurse call server. The nurse call server sends a Refer message
to a different address on the same subnet but Asterisk cannot find that device. If I manually type a dialplan to route calls to that device it does connect but the system could have many addresses and it would be impossible to tell what address and dial number would be in the Refer message
Asterik 10.2.87.201
Ascom 10.2.87.1
Refer Message refer-to: sip:V1003B0G65605773L0#10.2.87.11
I need to be able to have Asterisk transfer to that ext and domain dynamically.
This is a working example with a dialplan telling the system to manually send to the 10.2.87.11 address
exten => _VX.,n,Dial(SIP/${EXTEN}#10.2.87.11)
-- Executing [201*65609848#default:2] Dial("SIP/1341-000001cd", "SIP/T6/201*65609848") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/T6/201*65609848
> 0x7fba38016560 -- Strict RTP learning after remote address set to: 10.2.87.1:8766
-- SIP/T6-000001ce answered SIP/1341-000001cd
-- Channel SIP/T6-000001ce joined 'simple_bridge' basic-bridge <07b9ccbf-138d-423b-87cf-ad6c41336591>
-- Channel SIP/1341-000001cd joined 'simple_bridge' basic-bridge <07b9ccbf-138d-423b-87cf-ad6c41336591>
> Bridge 07b9ccbf-138d-423b-87cf-ad6c41336591: switching from simple_bridge technology to native_rtp
> Locally RTP bridged 'SIP/1341-000001cd' and 'SIP/T6-000001ce' in stack
> 0x7fb9c017aa00 -- Strict RTP learning after remote address set to: 192.168.21.82:16734
> Locally RTP bridged 'SIP/1341-000001cd' and 'SIP/T6-000001ce' in stack
> 0x7fb9c017aa00 -- Strict RTP switching to RTP target address 192.168.21.82:16734 as source
> Locally RTP bridged 'SIP/1341-000001cd' and 'SIP/T6-000001ce' in stack
-- Channel SIP/T6-000001ce left 'native_rtp' basic-bridge <07b9ccbf-138d-423b-87cf-ad6c41336591>
> Bridge 07b9ccbf-138d-423b-87cf-ad6c41336591: switching from native_rtp technology to simple_bridge
-- Channel SIP/1341-000001cd left 'simple_bridge' basic-bridge <07b9ccbf-138d-423b-87cf-ad6c41336591>
-- Executing [V1003B0G65609848L0#default:1] NoOp("SIP/1341-000001cd", "V1003B0G65609848L0") in new stack
-- Executing [V1003B0G65609848L0#default:2] Dial("SIP/1341-000001cd", "SIP/V1003B0G65609848L0#10.2.87.11") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/V1003B0G65609848L0#10.2.87.11
> 0x7fb9c017aa00 -- Strict RTP learning complete - Locking on source address 192.168.21.82:16734
> 0x7fba3802cb80 -- Strict RTP learning after remote address set to: 10.2.87.11:5012
-- SIP/10.2.87.11-000001cf answered SIP/1341-000001cd
-- Channel SIP/10.2.87.11-000001cf joined 'simple_bridge' basic-bridge <149e09d8-7d19-46fb-9135-43ffa33862e1>
-- Channel SIP/1341-000001cd joined 'simple_bridge' basic-bridge <149e09d8-7d19-46fb-9135-43ffa33862e1>
> Bridge 149e09d8-7d19-46fb-9135-43ffa33862e1: switching from simple_bridge technology to native_rtp
> Locally RTP bridged 'SIP/1341-000001cd' and 'SIP/10.2.87.11-000001cf' in stack
> 0x7fba3802cb80 -- Strict RTP switching to RTP target address 10.2.87.11:5012 as source
> 0x7fba3802cb80 -- Strict RTP learning complete - Locking on source address 10.2.87.11:5012
-- Channel SIP/1341-000001cd left 'native_rtp' basic-bridge <149e09d8-7d19-46fb-9135-43ffa33862e1>
-- Channel SIP/10.2.87.11-000001cf left 'native_rtp' basic-bridge <149e09d8-7d19-46fb-9135-43ffa33862e1>
== Spawn extension (default, V1003B0G65609848L0, 2) exited non-zero on 'SIP/1341-000001cd'
Not working when using a Transfer dialplan
> 0x7fb9c017aa00 -- Strict RTP learning after remote address set to: 192.168.21.82:16766
-- Executing [201*65609851#default:1] NoOp("SIP/1341-000001de", "201*65609851") in new stack
-- Executing [201*65609851#default:2] Dial("SIP/1341-000001de", "SIP/T6/201*65609851") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/T6/201*65609851
> 0x7fba4001ebf0 -- Strict RTP learning after remote address set to: 10.2.87.1:8766
-- SIP/T6-000001df answered SIP/1341-000001de
-- Channel SIP/T6-000001df joined 'simple_bridge' basic-bridge <9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab>
-- Channel SIP/1341-000001de joined 'simple_bridge' basic-bridge <9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab>
> Bridge 9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab: switching from simple_bridge technology to native_rtp
> Locally RTP bridged 'SIP/1341-000001de' and 'SIP/T6-000001df' in stack
> 0x7fb9c017aa00 -- Strict RTP learning after remote address set to: 192.168.21.82:16766
> Locally RTP bridged 'SIP/1341-000001de' and 'SIP/T6-000001df' in stack
> 0x7fb9c017aa00 -- Strict RTP switching to RTP target address 192.168.21.82:16766 as source
> Locally RTP bridged 'SIP/1341-000001de' and 'SIP/T6-000001df' in stack
-- Channel SIP/T6-000001df left 'native_rtp' basic-bridge <9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab>
> Bridge 9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab: switching from native_rtp technology to simple_bridge
-- Channel SIP/1341-000001de left 'simple_bridge' basic-bridge <9b4ac0b8-3bcf-4ef3-862a-46b36a7cddab>
-- Executing [V1003B0G65609851L0#default:1] NoOp("SIP/1341-000001de", "V1003B0G65609851L0") in new stack
-- Executing [V1003B0G65609851L0#default:2] Transfer("SIP/1341-000001de", "SIP/V1003B0G65609851L0") in new stack
== Using SIP RTP CoS mark 5
> 0x7fb9c0174940 -- Strict RTP learning after remote address set to: 192.168.21.82:16770
-- Executing [V1003B0G65609851L0#default:1] NoOp("SIP/1341-000001e0", "V1003B0G65609851L0") in new stack
-- Executing [V1003B0G65609851L0#default:2] Transfer("SIP/1341-000001e0", "SIP/V1003B0G65609851L0") in new stack
-- Auto fallthrough, channel 'SIP/1341-000001e0' status is 'UNKNOWN'
== Using SIP RTP CoS mark 5
> 0x7fb9c0174940 -- Strict RTP learning after remote address set to: 192.168.21.82:16770
-- Executing [V1003B0G65609851L0#default:1] NoOp("SIP/1341-000001e1", "V1003B0G65609851L0") in new stack
-- Executing [V1003B0G65609851L0#default:2] Transfer("SIP/1341-000001e1", "SIP/V1003B0G65609851L0") in new stack
-- Auto fallthrough, channel 'SIP/1341-000001e1' status is 'UNKNOWN'
== Using SIP RTP CoS mark 5
> 0x7fb9c0174940 -- Strict RTP learning after remote address set to: 192.168.21.82:16770
-- Executing [V1003B0G65609851L0#default:1] NoOp("SIP/1341-000001e2", "V1003B0G65609851L0") in new stack
-- Executing [V1003B0G65609851L0#default:2] Transfer("SIP/1341-000001e2", "SIP/V1003B0G65609851L0") in new stack
-- Auto fallthrough, channel 'SIP/1341-000001e2' status is 'UNKNOWN'
> 0x7fb9c0174940 -- Strict RTP learning after remote address set to: 192.168.21.82:16770
-- Auto fallthrough, channel 'SIP/1341-000001de' status is 'ANSWER'
In short I need the last example to dynamically send to the domain in the refer message.
Thank you for you help

I am not sure if this is correct but I got this to work by creating users for all the devices I needed to communicate to and adjusting my extensions.conf
exten => _VX.,n,Dial(SIP/${EXTEN}#${SIPDOMAIN})
fullname = 10.2.87.10
secret =
hasvoicemail = no
host = 10.2.87.10
userqphone = yes
qualify = no
hassip = yes
hasiax = no
callwaiting = yes
context = default

Related

Automatic terminating a call when call made

here is my Console log of asterisk server
[Feb 15 12:17:49] WARNING[3558][C-00000000]: res_rtp_asterisk.c:2141 dtlsetup: Could not set policies when setting up DTLS-SRTP on '0x7fd64400caa0
[Feb 15 12:17:49] WARNING[3558][C-00000000]: res_rtp_asterisk.c:4465 ast_d: RTP Read error: Unspecified. Hanging up.
Channel SIP/7005-00000000 left 'simple_bridge' basic-bridge <222810-4890-bedf-84d549cea2b0>
== Spawn extension (default, 7008, 1) exited non-zero on 'SIP/7005-0000
-- Channel SIP/7008-00000001 left 'simple_bridge' basic-bridge <222810-4890-bedf-84d549cea2b0>
IS Any changes needed in sip.conf ?
in sip.conf
[7005] ; This will be WebRTC client
type=peer ;
username=7005 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=Z-jj! ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=yes ; Asterisk will relay media for this peer
transport=udp,ws,wss,tcp ; Asterisk will allow this peer to register on UDP or WebSockets
dtlsenable=yes ; Tell Asterisk to enable DTLS for this peer
dtlsverify=no ; Tell Asterisk to not verify your DTLS certs
dtlscertfile=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS cert file is
dtlsprivatekey=/etc/asterisk/keys/asterisk.pem ; Tell Asterisk where your DTLS private key is
dtlssetup=actpass ; Tell Asterisk to use actpass SDP parameter when setting up DTLS
disallow=all
disallow=all
allow=ulaw
allow=alaw
allow=speex
allow=gsm
dtlsverify=fingerprint
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass
;nat=force_rport,comedia
force_avp=yes
Read error: Unspecified
Check your firewall and NAT settings.

Asterisk -- VOIP prepaid account setup (outbound through remote asterisk server)

I have a continental calling card and I'm not sure how to make it possible to dial out with my asterisk server.
It is a VOIP prepaid card. I can call out on a softphone using their server address and my username and password.
I can't figure out my sip.conf or my dial plan.
Here is what I have.
sip.conf:
[continentalcard]
host=continental.com
defaultuser=username ;; user on continental's server
secret=password
register => username:password#continental.com
context=global
[frank]
type=friend
defaultuser=frank ;; user on my local asterisk server
secret=password
host=dynamic
context=internal
extensions.conf:
[global]
CARD=SIP/continentalcard
[internal]
exten => 100,1,Dial(SIP/frank)
same => n,Hangup()
include => continentalcard
[continentalcard] ;; outgoing
exten => _1NXXNXXXXXX,1,Dial(${CARD}/${EXTEN})
I get the following message on the CLI as I try to dial out 1-222-333-4444 (not the real number):
== Using SIP RTP CoS mark 5
-- Executing [12223334444#internal:1] Dial("SIP/frank-00000151", "SIP/continentalcard:12223334444") in new stack
== Using SIP RTP CoS mark 5
[Oct 3 04:02:57] ERROR[22923]: netsock2.c:269 ast_sockaddr_resolve: getaddrinfo("continentalcard", "12223334444", ...): Servname not supported for ai_socktype
[Oct 3 04:02:57] WARNING[22923]: chan_sip.c:5866 create_addr: No such host: continentalcard:12223334444
[Oct 3 04:02:57] WARNING[22923]: app_dial.c:2345 dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)
== Everyone is busy/congested at this time (1:0/0/1)
-- Auto fallthrough, channel 'SIP/frank-00000151' status is 'CHANUNAVAIL'
Update: Filled sip.conf with the global context. Also just noticed your missing a / in extensions.conf. Please look below
You have your sip.conf formatted incorrectly.
[global]
register => username:password#continental.com
context=continentalcard
[continentalcard]
host=continental.com
defaultuser=username
secret=password
context=continentalcard
Registration should be placed under the [global] context in sip.conf.
Context should be continentalcard not global. When the softphone dials 1NXXNXXXXXX it should start using the continentalcard context from extensions and perform the Dial(${CARD}/${EXTEN})

Call cannot come into asterisk

I am Novice in asterisk I installed Asterisk but now when I calling with telephony call cannot
come into asterisk &
I config ed Outgoing call bat call cannot out asterisk when I write(asterisk -vvvvvr)
& I calling with outdoor display for me
-- Executing [09396464991#DLPN_Main:1] Macro("SIP/6001-00000000", "trunkdial -failover-0.3,DAHDI/g2/09396464991,DAHDI/g1/09396464991,trunk_1,trunk_1") in newstack
-- Executing [s#macro-trunkdial-failover-0.3:1] GotoIf("SIP/6001-00000000","0?1-fmsetcid,1") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:2] GotoIf("SIP/6001-00000000","0?1-setgbobname,1") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:3] Set("SIP/6001-00000000", "CALLERID(num)=6001") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:4] Set("SIP/6001-00000000", "CALLERID(all)=") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:5] GotoIf("SIP/6001-00000000","0?1-dial,1") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:6] Set("SIP/6001-00000000", "CALLERID(all)=") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:7] Set("SIP/6001-00000000", "CALLERID(all)=") in new stack
-- Executing [s#macro-trunkdial-failover-0.3:8] Goto("SIP/6001-00000000", "1-dial,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,1-dial,1)
-- Executing [1-dial#macro-trunkdial-failover-0.3:1] Dial("SIP/6001-00000000:", "DAHDI/g2/09396464991") in new stack
[Mar 10 13:40:04] **WARNING[2106]: channel.c:5627 ast_request: No channel type registered for 'DAHDI'**
[Mar 10 13:40:04] WARNING[2106]: app_dial.c:2274 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 66 - Channel not implemented)== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [1-dial#macro-trunkdial-failover-0.3:2] GotoIf("SIP/6001-00000000", "20 > 0?1-CHANUNAVAIL,1:1-out,1") in new stack
-- Goto (macro-trunkdial-failover-0.3,1-CHANUNAVAIL,1)
-- Executing [1-CHANUNAVAIL#macro-trunkdial-failover-0.3:1] Dial("SIP/6001-00000000", "DAHDI/g1/09396464991") in new stack [Mar 10 13:40:04] WARNING[2106]: channel.c:5627 ast_request: No channel type registered for 'DAHDI'
**[Mar 10 13:40:04] WARNING[2106]: app_dial.c:2274 dial_exec_full: Unable to create channel of type 'DAHDI' (cause 66 - Channel not implemented)== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [1-CHANUNAVAIL#macro-trunkdial-failover-0.3:2] Hangup("SIP/6001-00000000", "") in new stack**== Spawn extension (macro-trunkdial-failover-0.3, 1-CHANUNAVAIL, 2) exited non-zero on 'SIP/6001-00000000' in macro 'trunkdial-failover-0.3'== Spawn extension (DLPN_Main, 09396464991, 1) exited non-zero on 'SIP/6001-00
1) First check your dahdi config is present and it is ok. Use following to check it
dahdi_cfg -vvvv
2) check that your asterisk have pri/dahdi support.

Asterisk thinks outbound call is to fax machine

A user recently notified me that whenever they attempt to dial into a conference call at another company, the phone call would get dropped after 5 seconds or so. They also indicated that when the same number is called using a cell phone, there were no issues. I found the following entries in log file.
[May 4 11:58:20] VERBOSE[24063] app_dial.c: -- DAHDI/1-1 is ringing
[May 4 11:58:20] VERBOSE[24063] app_dial.c: -- DAHDI/1-1 answered SIP/145-00000005
[May 4 11:58:24] WARNING[24063] rtp.c: Don't know how to represent 'f'
[May 4 11:58:24] VERBOSE[24063] chan_dahdi.c: -- Redirecting DAHDI/1-1 to fax extension
[May 4 11:58:24] VERBOSE[24063] pbx.c: -- Executing [h#macro-dialout-trunk:1] Macro("SIP/145-00000005", "hangupcall,") in new stack
[May 4 11:58:24] VERBOSE[24063] pbx.c: -- Executing [s#macro-hangupcall:1] GotoIf("SIP/145-00000005", "1?theend") in new stack
I have not been able to determine a solution. Any insight or suggestions on solving this problem are appreciated.
(Using FreePBX v2.9; Asterisk v1.6.2.15.1; CentOS 5.5 (Final); Sangoma A102)
Try add into file
/etc/asterisk/sip_general_custom.conf
faxdetect=no
Also tried modiying chan_dahdi.conf, but that did not work.
Final solution was to modify these settings (changing from YES to NO) in /etc/wanrouter/wanpipe1.conf
TDMV_HW_DTMF = NO # YES: receive dtmf events from hardware
TDMV_HW_FAX_DETECT = NO # YES: receive fax 1100hz events from hardware

How to multicast using gen_udp in Erlang?

How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. Not only adding memberships at start-up, but adding memberships while running would be useful too.
Here is example code on how to listen in on Bonjour / Zeroconf traffic.
-module(zcclient).
-export([open/2,start/0]).
-export([stop/1,receiver/0]).
open(Addr,Port) ->
{ok,S} = gen_udp:open(Port,[{reuseaddr,true}, {ip,Addr}, {multicast_ttl,4}, {multicast_loop,false}, binary]),
inet:setopts(S,[{add_membership,{Addr,{0,0,0,0}}}]),
S.
close(S) -> gen_udp:close(S).
start() ->
S=open({224,0,0,251},5353),
Pid=spawn(?MODULE,receiver,[]),
gen_udp:controlling_process(S,Pid),
{S,Pid}.
stop({S,Pid}) ->
close(S),
Pid ! stop.
receiver() ->
receive
{udp, _Socket, IP, InPortNo, Packet} ->
io:format("~n~nFrom: ~p~nPort: ~p~nData: ~p~n",[IP,InPortNo,inet_dns:decode(Packet)]),
receiver();
stop -> true;
AnythingElse -> io:format("RECEIVED: ~p~n",[AnythingElse]),
receiver()
end.
Multicast sending has been answered, receipt requires subscription to the multicast group.
It (still) seems undocumented, but has been covered on the erlang-questions mailing list before. http://www.erlang.org/pipermail/erlang-questions/2003-March/008071.html
{ok, Socket} = gen_udp:open(Port, [binary, {active, false},
{reuseaddr, true},{ip, Addr},
{add_membership, {Addr, LAddr}}]).
where the Addr is the multicast group, and LAddr is a local interface. (code courtesy of mog)
The same options used above can be passed to inet:setopts including {drop_membership, {Addr, LAddr}} to stop listening to the group.
I try to get this example running on my PC. What could happen, if I get always the message {error,eaddrnotavail} by opening the receive socket?
Example 1: This works:
{ok, Socket} = gen_udp:open(?PORT, [{reuseaddr,true}, {ip,?SERVER_IP},
{multicast_ttl,4}, {multicast_loop,false}, binary]),
Example 2: Getting an runtime Error:
{ok, Socket} = gen_udp:open(?PORT, [{reuseaddr,true}, {ip,?MULTICAST_IP},
{multicast_ttl,4}, {multicast_loop,false}, binary]),
% --> {error,eaddrnotavail}
-define(SERVER_IP, {10,31,123,123}). % The IP of the current computer
-define(PORT, 5353).
-define(MULTICAST_IP, {224,0,0,251}).
Multicast is specified by IP Address
It's the same in erlang as for all languages. The IP addresses 224.0.0.0 through 239.255.255.255 are multicast addresses.
Pick an address in that range, check that you're not overlapping an already assigned address, and you are good to go.
http://www.iana.org/assignments/multicast-addresses

Resources