yes it works in asterisk v1.0.6 and lately 1.2beta2 with a new patch released last week...<br>
<br>
some notes:<br>
<br>
B2BUA scenario: <br>
<br>
<br>
<br>
|==========>(PSTN GW´s)<br>
|<br>
Nated_UA1 ===>> SER+rtpproxy <===> Asterisk B2BUA<br>
|
|<br>
UA2
<======|
|<br>
Prepaid System<br>
with RADIUS<br>
<br>
<br>
1.- Get the Perl MD5 Package from:<br>
<a href="http://www.cpan.org/modules/by-module/MD5/MD5-1.X.tar.gz">http://www.cpan.org/modules/by-module/MD5/MD5-1.X.tar.gz</a><br>
<br>
Install Perl MD5<br>
tar -zxf MD5-1.X.tar.gz<br>
cd MD5-1.X<br>
perl Makefile.PL<br>
make<br>
<br>
<br>
2.- Get the B2BUA patch from:<br>
<a href="http://download.berlios.de/b2bua/asterisk-b2bua-0.1.2.tgz">http://download.berlios.de/b2bua/asterisk-b2bua-0.1.2.tgz</a><br>
<br>
Unapack the B2BUA:<br>
tar -zxfv asterisk-b2bua-0.1.2.tgz<br>
<br>
<br>
3.- Get Asteriks version 1.0.6 with:<br>
cd /usr/src<br>
export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot<br>
cvs login ---- the password is anoncvs.<br>
cvs co -r v1-0-6 asterisk zaptel libpri<br>
<br>
4.- Patch Asterisk<br>
cd /asterisk<br>
cp /your_download_dir/asterisk-b2bua-0.1.2/patch/asterisk-1.0.6-b2bua.patch<br>
patch -p1 < asterisk-1.0.6-b2bua.patch<br>
<br>
---------><br>
<br>
Modify app_getchannelstate.c (line 44) in this way ... look<br>
<br>
Before ...<br>
<br>
static int get_channel_state(struct ast_channel *chan, void *data)<br>
{ <br>
struct localuser *u;<br>
LOCAL_USER_ADD(u);<br>
int res = -1;<br>
<br>
After ...<br>
<br>
static int get_channel_state(struct ast_channel *chan, void *data)<br>
{<br>
int res = -1;<br>
struct localuser *u;<br>
LOCAL_USER_ADD(u);<br>
<br>
----------> esto evita un error en la compilacion de asterisk.<br>
<br>
6.- Compile and install Asterisk<br>
cd ../zaptel<br>
make clean; make install<br>
cd ../libpri<br>
make clean; make install<br>
cd ../asterisk<br>
make clean; make install<br>
<br>
If new to Asterisk, create default configuration files:<br>
<br>
make samples<br>
<br>
7.- Get the Asterisk PERL AGI module from: <a href="http://asterisk.gnuinter.net/files/asterisk-perl-0.XX.tar.gz">http://asterisk.gnuinter.net/files/asterisk-perl-0.XX.tar.gz</a><br>
<br>
Install with:<br>
tar -zxfv asterisk-perl-0.XX.tar.gz<br>
cd asterisk-perl-0.XX<br>
perl Makefile.PL<br>
make all<br>
make install<br>
<br>
8.- Replace the contents of the file /etc/asterisk/extensions.conf with something like:<br>
<br>
[general]<br>
static=yes<br>
writeprotect=no<br>
<br>
[default]<br>
; Internationa LD <br>
exten => _011.,1,DeadAGI(/your_download_dir/asterisk-b2bua-0.1.2/agi/agi.pl)<br>
exten => _011.,2,Hangup()<br>
; National LD<br>
exten => _01.,1,DeadAGI(/your_download_dir/asterisk-b2bua-0.1.2/agi/agi.pl)<br>
exten => _01.,2,Hangup()<br>
; Add other routes here<br>
<br>
9.- Your /etc/asterisk/sip.conf file should look like:<br>
<br>
[general]<br>
context=default<br>
port=5060<br>
bindaddr=<a href="http://0.0.0.0">0.0.0.0</a><br>
srvlookup=yes<br>
disallow=all<br>
allow=ulaw<br>
allow=alaw <br>
allow=g729<br>
<br>
[sip_proxy]<br>
; For incoming calls only.<br>
type=peer<br>
host=<a href="http://10.10.10.1">10.10.10.1</a>
; Your SIP proxy IP address<br>
canreinvite=no <br>
<br>
Edit the file /your_download_dir/asterisk-b2bua-0.1.2/agi/config.pl <br>
In this file you specify the RADIUS and outgoing call leg parameters.<br>
<br>
Run Asterisk<br>
/usr/sbin/asterisk -vvvvg<br>
<br>
<br>
10.- Below is an example of how you could route between SER and B2BUA.<br>
<br>
<br>
#************************<br>
# We check credentials for registers<br>
#************************<br>
if (method=="REGISTER") {<br>
if (!www_authorize("your.domain", "subscriber")) {<br>
www_challenge("your.domain", "0");<br>
break;<br>
};<br>
save("location");<br>
break;<br>
};<br>
<br>
#************************<br>
# First we check the source of the call<br>
#************************<br>
# If the call comes from the gateway, no authentication is<br>
# required<br>
if (src_ip==<a href="http://10.10.10.2">10.10.10.2</a>) {<br>
log(1,"Call from pstn. \n");<br>
# If the call comes from B2BUA, no authentication is<br>
# required. The first leg of the call has already been<br>
# authenticated.<br>
} else if (src_ip==<a href="http://10.10.10.4">10.10.10.4</a>) {<br>
log(1,"Call from B2BUA. \n");<br>
} else {<br>
# We check user credentials<br>
if (method=="INVITE") {<br>
if (!proxy_authorize("your.domain", "subscriber")) {<br>
proxy_challenge("your.domain", "0");<br>
break;<br>
};<br>
<br>
};<br>
# Not all the users are prepaid, so we check the database<br>
# to see if the call will be routed through B2BUA.<br>
# If every call is to be routed through B2BUA the "is_user_in"<br>
# conditional is not required.<br>
if (is_user_in("From", "prep")) {<br>
rewritehost("<a href="http://10.10.10.4">10.10.10.4</a>");<br>
t_relay_to_udp("<a href="http://10.10.10.4">10.10.10.4</a>", "5060");<br>
break;<br>
};<br>
<br>
};<br>
<br>
#************************<br>
# Then we check the destination of the call<br>
#************************<br>
# We use a specific pattern to identify our SIP users.<br>
# This can be replaced with a database lookup if a pattern<br>
# is not possible.<br>
if (uri=~"^sip:666.+@.*") {<br>
# Look user in the location database<br>
if (!lookup("location")) {<br>
sl_send_reply("404", "Not Found");<br>
break;<br>
} else {<br>
# Try to send call to dest.<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
};<br>
};<br>
# Forward numeric uri's to PSTN gateways<br>
} else if (uri=~"^sip:[0-9]+@.*") {<br>
rewritehost("<a href="http://10.10.10.2">10.10.10.2</a>");<br>
t_relay();<br>
# Anything else is forbidden<br>
} else {<br>
sl_send_reply("403", "Call cannot be served here");<br>
break;<br>
};<br>
<br>
################################################################<br>
<br>
<br><br><div><span class="gmail_quote">On 10/28/05, <b class="gmail_sendername">Daniel Liu</b> <<a href="mailto:daniel.liu@cu88.com">daniel.liu@cu88.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I think it is better to use a B2BUA for prepaid.<br><br>Asterisk can do this job. But I don't know the stability.<br><br>regards,<br>Daniel<br><br>Ashutosh kumar write:<br><br>> Hi,<br>> OK, but how do you monitor the call while it is in progress?
<br>><br>> To disconnect the call, I am planning to use the session timers set in the<br>> header prior to intitiating the call, which will offload the task of<br>> montoring the call by SER, and disconnection-on-zero-credit will be handled
<br>> by our pstn gw. Am I wrong somewhere?<br>><br>><br>> Regards,<br>> Ashutosh<br>><br>> -----Original Message-----<br>> From: Ryan Pagquil [mailto:<a href="mailto:rpagquil@philonline.com">rpagquil@philonline.com
</a>]<br>> Sent: Friday, October 28, 2005 3:33 PM<br>> To: Ashutosh kumar<br>> Cc: <a href="mailto:serusers@lists.iptel.org">serusers@lists.iptel.org</a><br>> Subject: Re: [Serusers] Prepaid approach<br>><br>> Hi,<br>
> We are a bit similar in implementing prepaid service. Our users are<br>> normally can call other users in our domain, and they are initially not<br>> member of the pstn group in the ser.grp table. once they bought credits
<br>> they will be put in the "pstn" group and can call pstn destinations. But<br>> when they run out of credit, we sends a bye message using sipsak on both<br>> PSTN gateway and the user's IP phone.<br>
><br>> Regards,<br>> Ryan<br>><br>> Ashutosh kumar wrote:<br>><br>>> Hi,<br>>><br>>> While trying to implement prepaid solution using SER, I decided to go<br>>> be a intuitive approach which is as follows.
<br>>><br>>> -When the user registers, he is placed in a "voip?groups table of ser<br>>> (or radius server database), i.e he can make only pc-to-pc calls.<br>>><br>>> - Later , or otherwise, when the user registers, he is shifted to a
<br>>> "pstn?groups table of ser , i.e noew he can make only pc-to-pstn calls.<br>>><br>>> -Henceforth, whenever the user logins and tries to make pstn call, the<br>>> call is approved only if group_radius_is_user_in(username) succeds,
<br>>> else the call rejected by SER.<br>>><br>>> -To restrict the user from making pstn calls when his credits are zero<br>>> (or beyond a threshold) , a dedicated cron job is scripted to move<br>
>> users from "pstn?group to "voip?when their<br>>><br>>> account_cerdit=0.<br>>><br>>> Am I right in using this approach, or are there any foreseeable<br>>> problems which I might be overlooking.
<br>>><br>>> Thanks.<br>>><br>>> Regards,<br>>><br>>> Ashutosh Kumar<br>>><br>>>------------------------------------------------------------------------<br>>><br>>>_______________________________________________
<br>>>Serusers mailing list<br>>><a href="mailto:Serusers@iptel.org">serusers@lists.iptel.org</a><br>>><a href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>
<br>>><br>>><br>><br>><br>> --<br>> Ryan Pagquil<br>> Infodyne Inc. - PhilOnline.com<br>> 3603 Antel Global Corporate Center<br>> Doña Julia Vargas Ave.<br>> Ortigas Center Pasig City<br>
> Tel: 687-0715<br>> Web: <a href="http://www.philonline.com">www.philonline.com</a><br>><br>><br>><br>> _______________________________________________<br>> Serusers mailing list<br>> <a href="mailto:serusers@lists.iptel.org">
serusers@lists.iptel.org</a><br>> <a href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a><br><br><br>_______________________________________________<br>Serusers mailing list
<br><a href="mailto:serusers@lists.iptel.org">serusers@lists.iptel.org</a><br><a href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a><br><br><br></blockquote></div><br><br clear="all">
<br>-- <br><br>rrgv