Author Topic: Determining Call Direction for Asterisk  (Read 33603 times)

sergey

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 48
    • View Profile
Determining Call Direction for Asterisk
« on: May 12, 2005, 04:03:02 AM »
By default CAM uses fuzzy rules to determine direction of a call.
To allow the CAM exactly determine the direction from SMDR record you need configure Asterisk in a special way.

You should mark every Asterisk section entry that can make call with account code set to "OUTCOMING" and section that can accept call with account code set to "INCOMING".

Generally add following line

accountcode=OUTCOMING

to entries of type 'user' of 'friend' in sip.conf and iax.conf and add following line

accountcode=INCOMING

to entries of type 'peer' in sip.conf and iax.conf files and to channels in zapata.conf file.

For example, sif.conf:

[sip-phone]
type=user
;type=friend
accountcode=OUTCOMING
...

[sip-provider]
type=peer
accountcode=INCOMING
...


But in some cases for incoming calls Asterisk does not use accountcode from configuration file. You must set accountcode in your dial plan. For example, you have such entry for incoming calls (the calls is routed to 'router' context):

[sip-provider]
type=peer
accountcode=INCOMING
context=router
...

To adopt such dialplan for CAM make new intermediate context for the 'router':

[router-intermediate]
exten => _X.,1,SetAccount(INCOMING)
exten => _X.,2,Goto(router,${EXTEN},1)

[router]
exten => 2001,1,Dial(SIP/2001,20)
exten => 2001,2,Hangup
.....

and change context for 'sip-provider' from 'router' to 'router-intermediate'

[sip-provider]
type=peer
accountcode=INCOMING
context=router-intermediate
...

In intermidiate context first line force accountcode to be 'INCOMING' and the second line jump to original context as if there is no additional context exists.