一旦接听电话,就无法获得频道变量。 (星号)

时间:2012-09-29 15:19:32

标签: asterisk

我正在使用Asterisk和dot net发送将播放预先录制的消息的电话。有人建议我在拨号方案中使用拨号命令。 我的拨号计划

[cpc_sendcall]
exten => _X.,1,Set(CHANNEL(userfield)=${actionid})
same => n,NoOp(RecordCall: ${dorec})
same => n,GotoIf($[${dorec}=1]?record:norecord)
same => n(record),mixmonitor(${recfile}.gsm)
same => n(norecord),dial(SIP/${EXTEN}@${carrier},45,G(cpc_doamd,s,1))
same => n,hangup
same => n,CELGenUserEvent(CPC-Failed,${myactionid},HC:${HANGUPCAUSE},DS:${DIALSTATUS})

[cpc_doamd]
exten => s,1,answer
same => n,AMD
same => n,GotoIf($[${AMDSTATUS}=HUMAN]?humn:mach)
same => n(humn),CELGenUserEvent(CPC-LiveAnswer,${myactionid})
same => n,WaitForSilence(500)
same => n,NoOp(ProductLA: ${myproductla})
same => n,goto(${myproductla},s,1)
same => n,Hangup
same => n(mach),CELGenUserEvent(CPC-AnsweringMachine,${myactionid})
same => n,NoOp(ToneDigit: ${mytonedigit})
same => n,goto(cpc_tonevmdigit,${mytonedigit},1)
same => n,NoOp(ProductAM: ${myproductam})
same => n,goto(${myproductam},s,1)
same => n,Hangup

[cpc_tonevmdigit]
exten => _X,1,senddtmf(${EXTEN})
same => n,return
exten => 10,1,senddtmf(*)
same => n,return
exten => 11,1,senddtmf(#)
same => n,return
exten => 12,1,WaitForSilence(2000,1,120)
same => n,WaitForSilence(200,2,1)
same => n,return

和原始命令

Action: Originate
Channel: local/7062675733@cpc_sendcall
Exten: 7062675733
Context: gp_playintro
Async: 1
Priority: 1
Timeout: 60000
ActionID: GNE-1-1-1-0-0-1-7062675733-40304
Variable: assignmentid=ff830065-2419-4134-be89-36873d99e7c3,dorec=0,tonedigit=12,predigits=-1,postdigits=-1,playcompanygreeting=0,pin=-1,dosvr=0,playSurveyNotice=0,dolat=0,playlatnotice=0,playcompanytrailer=0,productam=gpstart,productla=gpstart,actionid=GNE-1-1-1-0-0-1-7062675733-40304,carrier=excel
CallerId: 4053084474
Account: G1

我想知道这是打电话的正确方法吗? 如何在应答呼叫后访问我设置的频道变量?

谢谢

1 个答案:

答案 0 :(得分:1)

使用sip调用时必须使用本地频道。一旦频道被挂断,变量就会消失。您可以使用本地频道来解决这个问题。

这是做这件事的好资源:

https://blogs.reucon.com/asterisk-java/originate-using-asterisk-local-channels-566/