Frank Kostin wrote:
Hi everybody, Looking to implement Codec Translator with Asterisk - loading codec modules API in Asterisk to support transcoding. Has anyone experienced this issue, and does anyone have any suggestions or hint, simple scripts, whatever ? Thanks in advance and kind Regards, Frank
Hi Frank
I am currently using Asterisk as a b2bua. Calls destined for the PSTN go via an asterisk server, which authorises the call based on the CLID, or prompts for a PIN, and forwards the call onto the PSTN Gateway. We use this solution to realise a pre-paid billing application. Asterisk will automagically do the codec translation as it's bridging the call. The downside to this solution is that codec tranlation is quite CPU intensive, so I would not expect to transcode a large number of calls. Anyone have any idea how many calls I could process on a dual xeon 2.4GHz machine with half a gig or RAM, or even better how I can test the capacity?
fragments of our ser.conf in the main route block:
if ( uri=~"sip:[0-9]{7,20}@.*") { log(1,"going to route(3) pstn!!...\n"); route(3); break; };
and then :
route[3] {
# all calls through the gateway must be record routed record_route();
# first the caller needs to be authenticated #(xxx.xxx.xxx.xxx is the ip address of SER server) if ( (uri=~"^sip:(.+@)?(xxx.xxx.xxx.xxx|(voip.)?mydomain.com)([:;?].*)?$")) { if (!(src_ip==xxx.xxx.xxx.xxx | method==ACK | method=="CANCEL" | method=="BYE")) { if (!proxy_authorize("mydomain.com", "subscriber")) { proxy_challenge( "mydomain.com","0"); break; } else if (method=="INVITE" & !check_from()) { log(1, "LOG: Spoofed from attempt\n"); sl_send_reply("403", "Use From=id next time"); break; }; }; # authenticated and authorized, now accounting is set setflag(1); };
#(yyy.yyy.yyy.yyy is the ip address of Asterisk server) rewritehostport("yyy.yyy.yyy.yyy:5060"); append_hf("P-hint: GATEWAY\r\n"); if (!t_relay()) { sl_reply_error(); break; }; }
Important bits from asterisk's sip.conf: [general] disallow=all allow=g729 allow=gsm autocreatepeer=yes
[yourpeer-egress] type=peer host=voip.yourpeer.com secret=nottelling username=myusername fromuser=myclid canreinvite=no dtmfmode=rfc2833 context=incoming
and finally in extensions.conf you need something like:
exten => _.,1,dial(SIP/${EXTEN}@mypeer-egress)
Noel