IVR语音菜单需要动态生成,找了一圈的资料,终于被自己试出来。
第一步:修改xml_curl.conf
<binding name="dialplan">
<param name="gateway-url" value="http://localhost:12569/Dialplan.ashx" bindings="dialplan"/>
</binding>
<binding name="ivr">
<param name="gateway-url" value="http://localhost:12569/Ivr.ashx" bindings="ivr"/>
</binding>
第二步:Ivr.ashx编码
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Write(OutPut());
}
public bool IsReusable
{
get
{
return false;
}
}
public string OutPut()
{
var sFs = "<document type=\"freeswitch/xml\">";
sFs = sFs + "<section name=\"configuration\">";
sFs = sFs + "<configuration name=\"ivr.conf\" description=\"IVR menus\">";
sFs = sFs + "<menus>";
sFs = sFs + "<menu name=\"welcome\" ";
sFs = sFs + "greet-long=\"custom/welcome.wav\" ";
sFs = sFs + "greet-short=\"custom/welcom_short.wav\" ";
sFs = sFs + "invalid-sound=\"custom/invalid.wav\" ";
sFs = sFs + "exit-sound=\"custom/goodbye.wav\" ";
sFs = sFs + "timeout=\"15000\" ";
sFs = sFs + "max-failures=\"3\" ";
sFs = sFs + "max-timeouts=\"3\" ";
sFs = sFs + "inter-digit-timeout=\"2000\" ";
sFs = sFs + "digit-len=\"4\">";
sFs = sFs + "<entry action=\"menu-exec-app\" digits=\"1\" param=\"record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav\"/>";
sFs = sFs + "</menu>";
sFs = sFs + "</menus>";
sFs = sFs + "</configuration>";
sFs = sFs + "</section>";
sFs = sFs + "</document>";
return sFs;
}
Dialplan.ashx 相关说明请看:http://www.cnblogs.com/chendaoyin/archive/2012/07/30/2615723.html
说明:今天在官方wiki查资料,显示xml_curl只能绑定4个节点
Section names are passed to the script(s) on the webserver; currently, section names include:
- configuration - configuration items, i.e. for mod_sofia or mod_dingaling
- directory - user directory
- dialplan - Dialplan items (for call routing)
- phrases - phrases for the SAY api (Speech Phrase Management)