如何通过Asterisk中的AGI C程序将传入呼叫路由到代理队列

时间:2015-02-11 12:46:12

标签: c asterisk sip asteriskami agi

我在C语言中使用AGI进行Asterisk中的基本呼叫中心设置

[PUNDIT]
exten =>92186,1,agi(Pundit/PunditBin)
exten=>92186,2,Hangup

PunditBin是一个C应用程序。在接到呼叫时,应用程序直接代理SIP URI,它可以工作(代理电话铃声)。

fprintf(stdout,"EXEC Dial SIP/%s,50\n",Free_Pundit);

但问题是我必须在应用程序本身中包含ACD逻辑。但是,我想使用Asterisk Queue和ACD机制。

我已按以下方式配置Asterisk ACD: -

**queues.conf:-**

[exchat_pundit]
musicclass=default       ; play [default] music
strategy=rrmemory        ; use the Round Robin Memory strategy
joinempty=no             ; do not join the queue when no members available
leavewhenempty=yes       ; leave the queue when no members available
ringinuse=no             ; don't ring members when already InUse (prevents
context=QueueMemberFunctions

**Extension.conf**
//Moving the call to Queue of agents
[Queues]
exten => 7001,1,Verbose(2,${CALLERID(all)} entering the chat Pundit queue)
same => n,Queue(exchat_pundit)
same => n,Hangup()



[LocalSets]
include => Queues      ; allow phones to call queues

//Agent Registration, Pause etc..
[QueueMemberFunctions]

exten => *54,1,Verbose(2,Logging In Queue Member)
   same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
   same => n,AddQueueMember(exchat_pundit,${MemberChannel})

; ${AQMSTATUS}
;   ADDED
;   MEMBERALREADY
;   NOSUCHQUEUE

exten => *56,1,Verbose(2,Logging Out Queue Member)
   same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
   same => n,RemoveQueueMember(exchat_pundit,${MemberChannel})

; ${RQMSTATUS}:
;    REMOVED
;    NOTINQUEUE
;    NOSUCHQUEUE

exten => *72,1,Verbose(2,Pause Queue Member)
   same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
   same => n,PauseQueueMember(exchat_pundit,${MemberChannel})

; ${PQMSTATUS}:
;     PAUSED
;     NOTFOUND

exten => *87,1,Verbose(2,Unpause Queue Member)
   same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(peername)})
   same => n,UnpauseQueueMember(exchat_pundit,${MemberChannel})

; ${UPQMSTATUS}:
;     UNPAUSED
;     NOTFOUND


**Sip.conf:-**

//Agents 
[ABC]
type=friend; 'user' takes incoming calls
secret=welcome ; password for authenticating the user
nat=yes
disallow=all ; Disallow all codecs for this peer or user definition.
allow=speex
allow=gsm
allow=ulaw
allow=alaw
host=dynamic ; what kind of host you are dealing with and the value .dynamic.
context=QueueMemberFunctions; this is what ties up the Asterisk SIP user with the dialplan in
username=ABC; this field specifies the user name for authentication.
regexten=ABC;


[XYZ]
type=friend; 'user' takes incoming calls
secret=welcome ; password for authenticating the user
disallow=all ; Disallow all codecs for this peer or user definition.
allow=speex
allow=gsm
allow=ulaw
allow=alaw
host=dynamic 
context=QueueMemberFunctions
username=XYZ; 
regexten=XYZ;

现在,当我直接使用sip电话拨打分机7001时,我的呼叫以循环方式发送给代理,它可以正常工作。

问题是当我从我的C代码拨打分机7001时,它不起作用。

fprintf(stdout,"EXEC Dial 7001,50\n");

我无法将来电发送到座席队列。

请帮我解决这个问题。

此致 Raghuvendra Kumar

1 个答案:

答案 0 :(得分:2)

您可以使用拨打本地频道的拨号来拨打此类

Dial(Local/7001@Queues,,n)

或在AGI

fprintf(stdout,"EXEC Dial \"Local/7001@Queues,50\"\n");