Asterisk: sip phones can detect hangup from ptsn phone outside of asterisk? - asterisk

A little complex situation.
I have a little asterisk server,works fine but has
one problem: if someone answer from a ptsn phone outside
asterisk,the sip phones of asterisk still ringin and waiting.
And you can hear the voicemail answering(sic!).
My home has 4 fxo "ports" on one port i connect the asterisk and the analogic phone via Wildcard TDM400P card with two modules.
The other 3 ports has analogic phones connect,the problem is
:if someone call and some other answer from one of the 3 phones
outside of asterisk,the sip phones connected via lan still ringin.
The question is: is possible for asterisk to detect the answer outside?
Any parameter to check?Thanks
This is my context in extensions.conf
I see asterisk give me errror "exit non 0 state on s,3 extension"
[entrata]
exten => s,1,Answer()
exten => s,2,GotoIf(${BLACKLIST()}?blacklisted)
exten => s,3,Dial(SIP/1002&SIP/1001&dahdi/1,150,t,m,r)
;exten => s,3,Voicemail(1002#interni)
exten => s,4,Hangup()
This is the dadhi-channels.conf
;;; line="1 WCTDM/4/0"
signalling=fxo_ks
callerid="Centralino Asterisk"
mailbox=4001
group=0
context=interni
channel => 1
context=default
;;; line="4 WCTDM/4/3"
signalling=fxs_ks
callerid=asreceived
group=0
context=entrata
channel => 4
context=default
and chan_dadhi.conf
[channels]
context=entrata
language=it
signalling=fxs_ks
rxwink=300 ; Atlas seems to use long (250ms) winks
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=yes
faxdetect=incoming
echotraining=800
rxgain=0.0
txgain=0.0
callgroup=2
pickupgroup=2
immediate=no
;Uncomment these lines if you have problems with the disconection of your analog lines
busydetect=yes
busycount=6
#include /etc/asterisk/dahdi-channels.conf

This is a common FXO tone detection problem. Please check your provider settings in FXO. The TDM400 is end of life.Please look at this: https://serverfault.com/questions/144713/pstn-trunk-tdm400p-install-on-asterisk-trixbox

Related

How to make a H.323 trunk in Asterisk 15

I'm trying to make a H.323 trunk in asterisk 15 (in a remote server with Ubuntu server 16 installed) with ooh323 addon, to test if works I've the softphone ekiga on my local machine. But when I call to test it not even entry the call, the Asterisk CLI doesn't show any useful information, infact doesn't show anything and the log always are empty even I put it explicitly in the ooh323.conf.
In simple words,I just want to call a h323 extension and hear the classic "hello world". Here's my configuration:
ooh323.conf:
[general]
port = 1720
bindaddr = 0.0.0.0
disallow=all
allow=alaw
dtmfmode=inband
gatekeeper = DISABLE
context=default
[307]
type=friend
context=default
host=my server ip
port=1720
disallow=all
allow=alaw,g729,gsm,slinear
extension.conf:
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
[default]
exten => _X!,1,Dial(H323/${EXTEN}#307)
exten => _X!,2,Playback(hello-world)
Any help is useful, thanks a lot.
UPDATE:
Now the calls come in, but I get:
chan_ooh323.c:1975 ooh323_onReceivedSetup: Unacceptable ip 187.155.24.149
Any ideas?

Either the outbound or inbound call only work in asterisk setup, not both. Why?

This is my sip.conf
; inbound configuration
[nexmo-sip]
fromdomain=sip.nexmo.com
type=friend
context=nexmo
insecure=port,invite
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833
[nexmo-sip-01](nexmo-sip)
host=173.193.199.24
[nexmo-sip-02](nexmo-sip)
host=174.37.245.34
[nexmo-sip-03](nexmo-sip)
host=5.10.112.121
[nexmo-sip-04](nexmo-sip)
host=5.10.112.122
[nexmo-sip-05](nexmo-sip)
host=119.81.44.6
[nexmo-sip-06](nexmo-sip)
host=119.81.44.7
;outbound configuration
[general]
register => <api-key>:<api-secret>#sip.nexmo.com
registerattempts=0
srvlookup=yes
context=nexmo-sip1
[nexmo]
username=<api-key>
host=sip.nexmo.com
defaultuser=<api-key>
fromuser=<myNumber123>
fromdomain=sip.nexmo.com
secret=<api-secret>
type=friend
context=nexmo-sip1
insecure=very
qualify=yes
nat=no
;Add your codec list here.
; Note: Use "ulaw" for US only, "alaw" for the rest of the world.
allow=ulaw
allow=alaw
allow=G729
dtmfmode=rfc2833
[<myNumber123>] ; this number is at soft phone client
type=friend
context=nexmo-sip1
host=dynamic
secret=<myNumber123>
qualify=yes
[<mynumber123456>] ; this is my mobile number
type=friend
context=nexmo-sip1
host=dynamic
secret=<secretkey>
qualify=yes
This is extensions.conf
[general]
live_dangerously=yes
[globals]
[nexmo-sip1]
exten => _X.,1,Dial(SIP/${EXTEN}#nexmo)
[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)
Setting 1: If above is the setting of extensions.conf, I am able to make outbound calls from my soft client, but not able to get inbound calls to that soft client
Setting 2: If I change the settings of extensions.conf as follows, I am able to get incoming calls at softclient, but not able to make outbound calls.
[general]
live_dangerously=yes
[globals]
[nexmo-sip1]
exten => _X.,1,Dial(SIP/${EXTEN},30)
[default]
exten => s,1,gosub(nexmo-sip1,${EXTEN},1)
Question 1) What should I change so that I get both outbound and inbound calls?
Question 2: When I set extensions.conf as in Setting 1, I don't hear the other side, but I hear both the side conversation when extensions.conf is set as in Setting 2. How to fix that? And this is the log I see when I don't hear
[Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4175 retrans_pkt: Retransmission timeout reached on transmission tvK9cRGNN- for seqno 21 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 8383ms with no response
[Jul 1 22:50:38] WARNING[11299]: chan_sip.c:4204 retrans_pkt: Hanging up call tvK9cRGNN- - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
I understand that there are lot of wrong configurations like insecure=very etc. But right now I want to make this prototype to work successfully
To make inbound and outbound calls work, you need to have 2 separate contexts inbound and for outbound.
Try to change your configs in following way, extensions.conf:
[general]
[globals]
[nexmo-sip2]
exten => _X.,1,Dial(SIP/${EXTEN}#nexmo)
[nexmo-sip1]
exten => _X.,1,Dial(SIP/${EXTEN},30)
In sip.conf please leave all what you have, just update lines what I pasted here:
[<myNumber123>] ; this number is at soft phone client
type=friend
context=nexmo-sip2
host=dynamic
secret=<myNumber123>
qualify=yes
[<mynumber123456>] ; this is my mobile number
type=friend
context=nexmo-sip2
host=dynamic
secret=<secretkey>
qualify=yes
As you can see we need to have 2 separate contexts for calls from your SIP extensions(nexmo-sip2) and for calls from your sip provider(nexmo-sip1).

Asterisk unable to receive DTMF tone

Asterisk unable to receive DTMF tone from sip client.
Im using the (d) flag in dial application to perfume one digit exit during ringing state. But unfortunately doesn't work.
Here is my sip configuration :-
[100]
type=friend
username=100
host=dynamic
nat=yes
canreinvite=no
allow=all
secret=xxxxx
context=sipphones
relaxdtmf=yes
dtmfmode=auto
rfc2833compensate=yes
[200]
type=friend
username=200
host=dynamic
nat=yes
canreinvite=no
allow=all
qualify=yes
secret=xxxxx
context=sipphones
relaxdtmf=yes
dtmfmode=auto
rfc2833compensate=yes
here is my extensions.conf:-
exten => 100,1,Set(EXITCONTEXT=exitContext)
exten => 100,n,Dial(SIP/100,30,dTt)
exten => 200,1,Set(EXITCONTEXT=exitContext)
exten => 200,n,Dial(SIP/200,30,dTt)
[exitContext]
exten =>9,1,Goto(sipphones,1,1)
Regards
-Hadi.Salem
In logger.conf add to console line
console=>dtmf,verbose,debug
After that see debug output.
You may want also change dtmfmode param in your trunk config.
http://www.voip-info.org/wiki/view/Asterisk+sip+dtmfmode
If your peers are in the same network, set nat to "no", that may help.

How to record friend call on Asterisk

I have installed Asterisk on Ubuntu
sip.conf
[10000001]
type=friend
host=dynamic
qualify=yes
secret=pw_random
context=demo
[10000002]
type=friend
host=dynamic
qualify=yes
secret=pw_random
context=demo
...
extensions.conf
[demo]
exten => _1XXXXXXX,1,Dial(SIP/${EXTEN})
exten => _1XXXXXXX,2,Set(CALLFILENAME=${EXTEN:1})
exten => _1XXXXXXX,3,Monitor(wav,${CALLFILENAME},m)
However, Asterisk runs Dial and gets stuck, the users can talk each other on call, but Asterisk doesn't record the audio
run asterisk -rvvv, I get
-- Executing [10000001#demo:1] Dial("SIP/10000002-00000045", "SIP/10000001") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/10000001
-- SIP/10000001-00000046 is ringing
-- SIP/10000001-00000046 answered SIP/10000002-00000045
-- Channel SIP/10000002-00000045 joined 'simple_bridge' basic-bridge <1b882cee-b0f0-473f-aafb-651169788159>
-- Channel SIP/10000001-00000046 joined 'simple_bridge' basic-bridge <1b882cee-b0f0-473f-aafb-651169788159>
Any idea? Thanks!!
Update:
If I modify extensions.conf to
exten => _1XXXXXXX,1,Set(CALLFILENAME=${EXTEN})
exten => _1XXXXXXX,2,Monitor(wav,${CALLFILENAME},m)
exten => _1XXXXXXX,3,Dial(SIP/${EXTEN})
log is
-- Executing [10000001#demo:1] Set("SIP/10000002-00000000", "CALLFILENAME=10000001") in new stack
[Apr 14 00:56:50] WARNING[8649][C-00000000]: pbx.c:4910 pbx_extension_helper: No application 'Monitor' for extension (demo, 10000001, 2)
== Spawn extension (demo, 10000001, 2) exited non-zero on 'SIP/10000002-00000000'
error pbx_extension_helper: No application 'Monitor' for extension is weird.
I fixed it.
It's due to pbx_extension_helper: No application 'Monitor' for extension
Application 'Monitor' is not found because asterisk doesn't load res_monitor module according to this link
So, I add load=res_monitor.so in /etc/asterisk/modules.conf
The file looks like
[modules]
autoload=yes
load=pbx_config.so
load=chan_sip.so
load=chan_iax2.so
load=res_rtp_asterisk.so
load=app_hangup.so
load=app_dial.so
load=app_stack.so
load=res_monitor.so
load=pbx_functions.so
load=codec_ulaw.so
load=codec_gsm.so
load=bridge_simple.so
Thank Shu Zhang!
Have you checked the directory /var/lib/asterisk/sounds/, /var/spool/asterisk/monitor, or you can find your ubuntu files by your file name. Since the verbose didn't show any warning I believe you are doing this right but the recorded file is hiding somewhere. You can fix the file name .
exten => _1XXXXXXX,3,Monitor(wav,fixedfilename)
And find this file name in linux.
Moreover you can take a look of this
[a link]http://www.voip-info.org/wiki/view/Asterisk+cmd+Record
this is an old but i had the same problem, the way you solved it its correct, but you are just loading ALL MODULES... instead of making an slim module load.
[modules]
autoload=yes <---- THIS
load=pbx_config.so <---- DISABLED THIS
load=chan_sip.so
load=chan_iax2.so
So in order to make it work in a slim module load configuracion you must load
[modules]
autoload=no <---- THIS to NO
...
load=func_periodic_hook.so <---- THIS IS NEEDED IN ORDER TO LOAD MONITOR
load=load=res_monitor.so.so
...
Obviouly you need codecs and formats, here is a good slim config.
https://www.voip-info.org/asterisk-slimming/

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})

Resources