[asterisk-dev] Can I tell if a call picked up on PSTN extension... for example?

Michael Higgins linux at evolone.org
Fri Mar 20 10:22:12 CDT 2009


Don't know enough to properly term the problem I'm seeing... sorry if subject appears vague. And I have other questions too, but "Newbie Help Wanted" isn't exactly more specific... ;-)

My setup, intended for testing and all, "*" version 1.6.0.6, dahdi with an X100p clone. Regular phone line provides PSTN access with one port (and my DSL).

Calls come in and are passed to 'linphone' on a laptop inside my local network. Everything works great with IAX2 and SIP peers, in that, calls end and linphone reports 'call terminated', or whatever. All *so* very cool! '-)

But, when someone calls on the land line, there are issues. First, I admit to having virtually no clue what I'm doing... but, here goes:

When the caller hangs up, linphone doesn't "know". This is an annoyance, more than anything, perhaps, as I'm not sure yet if it shows busy on the other end.

And, to the "Subject:", when a call comes in, if someone should pick up on a phone attached on the PSTN line elsewhere, the dialplan continues, announces prompts and records a voice mail...

Should it, or could it even, detect if the line was picked up elsewhere? There's only one port on the card.

I have a feeling there are glaring errors in my setup, so hope I'm not asking too much indulgence from the list to have a look... IOW, I'm keen to test in the latest branch moving forward, so thinking maybe asking a little help on this glorified home answering machine setup isn't *too* far out of line. '-)

. . .

Here are my configs, hopefully well sanitized... 

 # cat /etc/asterisk/chan_dahdi.conf 

[trunkgroups]

[channels]
toneduration=250
usecallerid=yes
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes

transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes

echocancel=yes
echocancelwhenbridged=no
echotraining=yes

rxgain=10
txgain=10

group=1
callgroup=1
pickupgroup=1

immediate=yes
ringtimeout=8000

signalling=fxs_ls
callerid=asreceived
channel => 1

 # cat /etc/asterisk/extensions.conf 

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp				
TRUNK=DAHDI/g1					
TRUNKMSD=0

[trunktollfree]
exten => _91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten => _91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})

[macro-stdexten]
exten => s,1,Dial(${ARG2},20,m) 
exten => s,2,Goto(s-${DIALSTATUS},1) 
exten => s-BUSY,1,Voicemail(${ARG1},b) 
exten => s-BUSY,2,Goto(default,s,5) 
exten => s-NOANSWER,1,Voicemail(${ARG1},u) 
exten => s-NOANSWER,2,Goto(default,s,5) 
exten => _s-.,1,Goto(s-NOANSWER,1) 

[macro-trunkdial]
exten => s,1,Dial(${ARG1})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Hangup
exten => s-BUSY,1,Hangup
exten => _s-.,1,NoOp

[page]
exten => _X.,1,Macro(page,SIP/${EXTEN})

[opensky] 
exten => _1.,1,NoOp('opensky dial')
exten => _1.,2,Dial(SIP/${EXTEN}@gizmo5|120|j) 	
exten => _1.,3,Hangup() 	

[default]

include => opensky 
;# interrupt to voicemail  
exten => a,1,VoicemailMain(${mbx})		
exten => a,n,Hangup()

;# Answering machine...???
exten => s,1,Verbose(1|dumb answering machine|${CALLERIDNUM}) 
; pick up local extension?
exten => s,2,Wait(10)
exten => s,3,Answer() 
exten => s,4,Macro(stdexten,6666,SIP/linphone) 
exten => s,5,Hangup() 
exten => s,6,SoftHangup(SIP/linphone)
exten => s,7(fail),Hangup

exten => 600,1,Playback(demo-echotest)	
exten => 600,n,Echo			
exten => 600,n,Playback(demo-echodone)	
exten => 600,n,Hangup()

;# record message
exten => 1205,1,Wait(2)
exten => 1205,2,Record(/tmp/asterisk-recording:gsm)
exten => 1205,3,Hangup

exten => _X.,1,Dial(DAHDI/1/${EXTEN})
exten => _X.,n,Hangup() 

;# opensky gizmo5
exten => _1333.,1,Goto(opensky,,1)  	
exten => _333.,1,Goto(opensky,,1) 	;COPY THIS CONFIG
exten => _skype[_].,1,Goto(opensky,,1) 	;INTO YOUR
exten => 563,1,Dial(SIP/skype_echo123 at proxy01.sipphone.com) 	;extensions.conf

; transfer all to cell phone
exten => 5555,1,Wait(1)
exten => 5555,n,Dial(DAHDI/1/*72XXXXXXXXXX,,) 
exten => 5555,n,Wait(1)
exten => 5555,n,Hangup() 

exten => XXXX,1,Dial(SIP/linphone,20)
exten => XXXX,n,Hangup() 

; straight to voicemail
exten => 6666,1,Voicemail(6666 at default) 
exten => 6666,n,Hangup() 

exten => 8500,1,VoicemailMain
exten => 8500,n,Hangup


 # cat /etc/asterisk/iax.conf 

[general]
bandwidth=low
disallow=lpc10			
jitterbuffer=no
forcejitterbuffer=no
autokill=yes

[guest]
type=user
context=default
callerid="Guest IAX User"

[iaxtel]
type=user
context=default
auth=rsa
inkeys=iaxtel

[iaxfwd]
type=user
context=default
auth=rsa
inkeys=freeworlddialup

[demo]
type=peer
username=asterisk
secret=supersecret
host=216.207.245.47

[XXXX]
type=user
insecure=very
context=default
context=default 
disallow=all
allow=ulaw
allow=alaw
allow=gsm

 # cat /etc/asterisk/modules.conf 

[modules]
autoload=yes
preload => func_strings.so
noload => pbx_gtkconsole.so
load => res_musiconhold.so
noload => chan_alsa.so

 # cat /etc/asterisk/musiconhold.conf 

[general]

[default]
mode=files
directory=/var/lib/asterisk/moh

 # cat /etc/asterisk/phone.conf 

[interfaces]
mode=fxo
;mode=immediate
format=slinear
echocancel=medium

 # cat /etc/asterisk/sip.conf 

[general]
context=default                 
allowoverlap=no                 
bindport=5060                   
bindaddr=0.0.0.0                
tcpenable=no                    
tcpbindaddr=0.0.0.0             
srvlookup=yes                   
localnet=192.168.1.0/23 
externip = XXX.XXX.XXX.XXX

[authentication]

[basic-options](!)                
        dtmfmode=rfc2833
        context=from-office
        type=friend

[natted-phone](!,basic-options)   
        nat=yes
        canreinvite=no
        host=dynamic

[public-phone](!,basic-options)   
        nat=no
        canreinvite=yes

[my-codecs](!)                    
        disallow=all
        allow=ilbc
        allow=g729
        allow=gsm
        allow=g723
        allow=ulaw

[ulaw-phone](!)                   
        disallow=all
        allow=ulaw

[linphone]
type=peer
context=default                
secret=secret
host=dynamic                    
dtmfmode=inband                
defaultuser=defaultuser               
canreinvite=yes
disallow=all
allow=ulaw
allow=alaw 
allow=speex

[gizmo5]  	
type=peer
host=198.65.166.131
fromdomain=proxy01.sipphone.com
canreinvite=no
nat=yes
dtmfmode=rfc2833
insecure=very
qualify=yes
fromuser=x-xxx-xxx-xxxx
authuser=x-xxx-xxx-xxxx
username=x-xxx-xxx-xxxx
secret=ohsoverysecret
disallow=all
allow=ulaw
allow=alaw 	
allow=ilbc 

 # cat /etc/asterisk/voicemail.conf 

[general]
format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emaildateformat=%A, %B %d, %Y at %r
sendvoicemail=yes 

[zonemessages]
eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Copenhagen|'vm-received' a d b 'digits/at' HM

[default]
1234 => XXXX,Example Mailbox,root at localhost
6666 => XXXX,Test Mailbox,linux at evolone.org

[other]
1234 => XXXX,Company2 User,root at localhost

. . . 

Having posted all that, it'd be nice if someone points out the "big whoops-es" before they're exploited or something.

SIP and IAX2 seem to "just work". ;-) Though, looking again, I have to wonder about 'bandwidth=low', like where did that come from... might explain the cheesy sound on that line.

Anyway, I'd like to have a good first commit of my configs to SVN before I start playing around and breaking things... and much obliged to anyone who helps.

# asterisk -V && uname -a
Asterisk 1.6.0.6
Linux lbg2 2.6.27-gentoo-r8 #1 Sat Mar 14 20:06:08 PDT 2009 i686 AMD Athlon(tm) XP 2400+ AuthenticAMD GNU/Linux

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the asterisk-dev mailing list