Comment on my setup

Hi All,

I’m new to Asterisk and learning how to get it to do what I want. Basically the one I’m building here will sit between our external provider and a range of PBX’s for our customers. I want to log the calls in/out etc using an external system we already have doing other work. Below is my configs for sip.conf and extensions.conf.

If anyone has any comments on how I’m doing things I’d be interested:

[general]
register => user:pwd@sip99.abc.com
context=default
allowguest=no
alwaysauthreject=yes

[abc]
disallow=all
allow=ulaw,alaw,gsm
username=user
type=peer
secret=pwd
insecure=port,invite
host=sip99.abc.com
fromuser=user
fromdomain=sip99.abc.com
dtmfmode=rfc2833
context=in-abc
qualify=yes
directmedia=no

[client1]
disallow=all
allow=ulaw,alaw,gsm
username=client1
type=peer
secret=reallystrongpasword
nat=force_rport,comedia 
insecure=port,invite
host=dynamic
context=in-client1
qualify=yes
directmedia=no
deny=0.0.0.0/0
permit=client1ipaddress/32
[default]
; default context should always be empty

[in-abc]
exten => _XXXXXXXXXXX,1,Set(SRC_CONTEXT=${CONTEXT})
same => n,Goto(inbound-call,${EXTEN},1)
same => n,Hangup()

[inbound-call]
exten => _X.,1,Set(CALL_SEQ=${CURL(http://webserver/authcall.aspx?dir=in&cid=${CALLERID(num)}&dest=${EXTEN}&peerip=${CHANNEL(peerip)}&recvip=${CHANNEL(recvip)}&srccontext=${SRC_CONTEXT})})
same => n,GotoIf($["${CALL_SEQ:0:3}" != "OK:"]?reject-call,${EXTEN},1)
same => n,Set(CHANNEL(hangup_handler_push)=hangup-handler,${EXTEN},1(args))
same => n,SipAddHeader(P-Asserted-Identity: <sip:${CALLERID(num)}>)
same => n,Gosub(handle-in-did,${EXTEN},1)
same => n,Busy(5)
same => n,Hangup()

[handle-in-did]
exten => _61yyyyyyy[01],1,Dial(SIP/client1/${EXTEN},60)		*** have abstracted phone # with y's
exten => _X.,1,Return()

[hangup-handler]
exten => _X.,1,Set(APICALLRESULT=${CURL(http://webserver/endcall.aspx?CALL_SEQ=${CALL_SEQ}&answeredtime=${ANSWEREDTIME}&dialstatus=${DIALSTATUS}&hangupcause=${HANGUPCAUSE})})
exten => _X.,n,Return()

[reject-call]
exten => _X.,1,Hangup(403)

[outbound-call]
exten =>_X.,1,Set(CALL_SEQ=${CURL(http://webserver/authcall.aspx?dir=out&cid=${CALLERID(num)}&dest=${EXTEN}&peerip=${CHANNEL(peerip)}&recvip=${CHANNEL(recvip)}&srccontext=${SRC_CONTEXT})})
same => n,GotoIf($["${CALL_SEQ:0:3}" != "OK:"]?reject-call,${EXTEN},1)
same => n,Set(CHANNEL(hangup_handler_push)=hangup-handler,${EXTEN},1(args))
same => n,SipAddHeader(P-Asserted-Identity: <sip:${CALLERID(num)}>)
same => n,Gosub(handle-in-did,${EXTEN},1)
same => n,Dial(SIP/abc/${EXTEN},60)
same => n,Hangup()

[in-client1]
exten => _X.,1,Set(SRC_CONTEXT=${CONTEXT})
same => n,Goto(outbound-call,${EXTEN},1)
sip*CLI>
  == Using SIP RTP CoS mark 5
       > 0x7f31681720e0 -- Strict RTP learning after remote address set to: 103.XXX.YYY.58:18996
    -- Executing [61yyyyyyyyy@in-client1:1] Set("SIP/client1-0000015e", "SRC_CONTEXT=in-client1") in new stack
    -- Executing [61yyyyyyyyy@in-client1:2] Goto("SIP/client1-0000015e", "outbound-call,61yyyyyyyyy,1") in new stack
    -- Goto (outbound-call,61yyyyyyyyy,1)
    -- Executing [61yyyyyyyyy@outbound-call:1] Set("SIP/client1-0000015e", "CALL_SEQ=OK:1000000000000045") in new stack
    -- Executing [61yyyyyyyyy@outbound-call:2] GotoIf("SIP/client1-0000015e", "0?reject-call,61yyyyyyyyy,1") in new stack
    -- Executing [61yyyyyyyyy@outbound-call:3] Set("SIP/client1-0000015e", "CHANNEL(hangup_handler_push)=hangup-handler,61yyyyyyyyy,1(args)") in new stack
    -- Executing [61yyyyyyyyy@outbound-call:4] SIPAddHeader("SIP/client1-0000015e", "P-Asserted-Identity: <sip:61qqqqqqqqq>") in new stack
    -- Executing [61yyyyyyyyy@outbound-call:5] Gosub("SIP/client1-0000015e", "handle-in-did,61yyyyyyyyy,1") in new stack
    -- Executing [61yyyyyyyyy@handle-in-did:1] Return("SIP/client1-0000015e", "") in new stack
    -- Executing [61yyyyyyyyy@outbound-call:6] Dial("SIP/client1-0000015e", "SIP/abc/61yyyyyyyyy,60") in new stack
  == Using SIP RTP CoS mark 5
    -- Called SIP/abc/61yyyyyyyyy
    -- SIP/abc-0000015f is ringing
       > 0x7f31f4032bd0 -- Strict RTP learning after remote address set to: 35.AAA.BBB.225:10378
    -- SIP/abc-0000015f answered SIP/client1-0000015e
    -- Channel SIP/abc-0000015f joined 'simple_bridge' basic-bridge <0669fbc8-2995-4ec0-bf9c-8a440e691952>
    -- Channel SIP/client1-0000015e joined 'simple_bridge' basic-bridge <0669fbc8-2995-4ec0-bf9c-8a440e691952>
       > Bridge 0669fbc8-2995-4ec0-bf9c-8a440e691952: switching from simple_bridge technology to native_rtp
       > Locally RTP bridged 'SIP/client1-0000015e' and 'SIP/abc-0000015f' in stack
       > 0x7f31f4032bd0 -- Strict RTP switching to RTP target address 35.AAA.BBB.225:10378 as source
       > 0x7f31681720e0 -- Strict RTP switching to RTP target address 103.XXX.YYY.58:18996 as source
       > 0x7f31681720e0 -- Strict RTP learning complete - Locking on source address 103.XXX.YYY.58:18996
       > 0x7f31f4032bd0 -- Strict RTP learning complete - Locking on source address 35.AAA.BBB.225:10378
    -- Channel SIP/client1-0000015e left 'native_rtp' basic-bridge <0669fbc8-2995-4ec0-bf9c-8a440e691952>
    -- Channel SIP/abc-0000015f left 'native_rtp' basic-bridge <0669fbc8-2995-4ec0-bf9c-8a440e691952>
  == Spawn extension (outbound-call, 61yyyyyyyyy, 6) exited non-zero on 'SIP/client1-0000015e'
    -- SIP/client1-0000015e Internal Gosub(hangup-handler,61yyyyyyyyy,1(args)) start
    -- Executing [61yyyyyyyyy@hangup-handler:1] Set("SIP/client1-0000015e", "APICALLRESULT=CALL_SEQ=1000000000000045, Status=NORMAL_CLEARED") in new stack
    -- Executing [61yyyyyyyyy@hangup-handler:2] Return("SIP/client1-0000015e", "") in new stack
  == Spawn extension (outbound-call, 61yyyyyyyyy, 6) exited non-zero on 'SIP/client1-0000015e'
    -- SIP/client1-0000015e Internal Gosub(hangup-handler,61yyyyyyyyy,1(args)) complete GOSUB_RETVAL=