asterisk2billing.org
http://forum.asterisk2billing.org/

Calls between extensions...
http://forum.asterisk2billing.org/viewtopic.php?f=33&t=7527
Page 1 of 1

Author:  Ju4nCh0 [ Tue Apr 20, 2010 11:22 pm ]
Post subject:  Calls between extensions...

Hey there, I've been looking for a way to let customers call each other dialing some sort of extension...

However, all I find is based in old releases, and none of them worked... I already enabled the "sip_iax_friends" and set "sip_iax_pstn_direct_call_prefix" to 555 in my agi-conf1... however, when I call for example 555 6703753660 being 6703753660 my username/accountcode and the system tries to rout the call to the trunk, and, since it's not starting with 9 (my prefix for outgoing calls), the call won't go thru and it asks for the number to call.

I'm getting desperate here.

Thanks for your help

Author:  manugmedia [ Tue Apr 20, 2010 11:51 pm ]
Post subject:  Re: Calls between extensions...

are you routing internal extension based on freepbx or what?

Quote:
since it's not starting with 9 (my prefix for outgoing calls), the call won't go thru and it asks for the number to call.


don't make sense to me. in 1.5 you need not alow sip iax friends for intercalls.

if using 1.5>. create a fake DID say 1234 and in destination set 1234 to SIP or IAX2/account number

Rgds
Eamonn

http://www.eatelco.com

Author:  LFCII [ Wed Apr 21, 2010 2:32 am ]
Post subject:  Re: Calls between extensions...

Hi,

As Eamonn indicates, you should be able to just assign DID's and the calls will do an internal route. At least this is how it works for me.

Kind Regards,

Les

Author:  Ju4nCh0 [ Wed Apr 21, 2010 7:02 pm ]
Post subject:  Re: Calls between extensions...

manugmedia wrote:
are you routing internal extension based on freepbx or what?

don't make sense to me. in 1.5 you need not alow sip iax friends for intercalls.

if using 1.5>. create a fake DID say 1234 and in destination set 1234 to SIP or IAX2/account number


Nope, no FreePBX... my server has Debian, MySQL, Apache, PHP and a2billing... and that's it.

What I meant was... I need a prefix for outgoing calls... for example, I wanna call 12345678, I must dial 912345678... my rate automatically removes 9 and dials... that's a request of the PBX owners.

So I need to dial, for example 1234 and another extension rings... I read that it was possible using Alias on the cards, however, that was based in old releases... I can't find where to do that, and that's what I was asking... Now...

LFCII wrote:
As Eamonn indicates, you should be able to just assign DID's and the calls will do an internal route. At least this is how it works for me.s


It does sound logical... lemme try and come back with results.

Thanks a lot =D

Author:  Ju4nCh0 [ Wed Apr 21, 2010 7:30 pm ]
Post subject:  Re: Calls between extensions...

Nope, didn't work... we have the prefix issue... system doesn't find 9 at the begining, so it doesn't dial and asks for a real phone number :S

Author:  jroper [ Wed Apr 21, 2010 9:03 pm ]
Post subject:  Re: Calls between extensions...

Hi

Ideally, your customer may deliver 9+some digits to Asterisk, but I think you should strip of the 9 before passing into A2Billing.

Each customer is assigned a DID, with a destination, and then when one customer calls another's, their extension will will ring.

Joe

Author:  Ju4nCh0 [ Wed Apr 21, 2010 10:38 pm ]
Post subject:  Re: Calls between extensions...

jroper wrote:
Hi

Ideally, your customer may deliver 9+some digits to Asterisk, but I think you should strip of the 9 before passing into A2Billing.

Each customer is assigned a DID, with a destination, and then when one customer calls another's, their extension will will ring.

Joe


Yep, that's exactly what it does... i just said "remove" instead of "strip"... however... I'm aware they can dial the DID... but it's not practical... for example

I dial 912345678, my dialplan strips 9 and i get 12345678, since this is a local number, it will go thru the trunk, and then come back to my own PBX...

So basically, if I make them use the DID... every call to an internal extension would be like a local call... which will be billed... Besides... it's not "comfy" to dial 9 numbers, instead of just 4 (like a regular office extension)...

Which reminds me, and FYI... This is a project for a Tech Park, meaning, several companies rent office space in a large building. And it's all "controlled" by only one PBX.

Author:  vulcan [ Wed Apr 21, 2010 11:11 pm ]
Post subject:  Re: Calls between extensions...

Not sure if this method will work for you, but the typical way in which you would set up an internal PBX, seems to be what you are describing.

You create sip extensions in asterisk and provide these logon credentials to your customers. Then you create inbound routes for the DID's and route them to the respective extensions. Then you can set their caller ID per extension for outbound calls with their DID.

Internal calls are free and A2B will handle outbound. This is easier to setup with freepbx though.

Author:  Ju4nCh0 [ Thu Apr 22, 2010 4:08 pm ]
Post subject:  Re: Calls between extensions...

vulcan wrote:
Not sure if this method will work for you, but the typical way in which you would set up an internal PBX, seems to be what you are describing.

You create sip extensions in asterisk and provide these logon credentials to your customers. Then you create inbound routes for the DID's and route them to the respective extensions. Then you can set their caller ID per extension for outbound calls with their DID.

Internal calls are free and A2B will handle outbound. This is easier to setup with freepbx though.


Never thought about that...

I'm about to finish a different AGI... to have something like...

Code:
[a2billing]
; CallingCard application
exten => _5.,1,DeadAGI(internaldialing.php)
exten => _5.,2,Hangup
exten => _X.,1,GotoIf($["${EXTEN}" = "6600"]? 4)
exten => _X.,2,DeadAGI(a2billing.php|1)
exten => _X.,3,Hangup
exten => _X.,4,VoicemailMain()
exten => _X.,5,Hangup


So if they dial 51234, it will run my AGI, it'll just compare the extension dialed with one database table, and if it exists, it'll rout it to the a2billing extension...

In case it doesn't work, i'll try what u said...

Thanks a lot =D

Author:  Ju4nCh0 [ Thu Apr 22, 2010 5:31 pm ]
Post subject:  Re: Calls between extensions...

Complete sucess =D

And I wanna share it with u ppl

This is my AGI

Code:
#!/usr/bin/php -q
<?
include (dirname(__FILE__)."/lib/phpagi/phpagi.php");
include (dirname(__FILE__)."/lib/phpagi/phpagi-asmanager.php");
$agi = new AGI();

$no = substr($agi->request[agi_dnid], 1);//Gets the DNID except the first digit (5), the prefix

$db = 'mydb';
$dbuser = 'root';
$dbpass = 'mypassword';
$dbhost = 'localhost';

mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("$db");
$row=mysql_query("SELECT * FROM aa_alias WHERE alias = ".$no." LIMIT 1");
if(mysql_num_rows($row) == 1)
{
   $row=mysql_fetch_object($row);
   $agi->set_variable("blah", $row->extension);
}
?>


And in extensions.conf...

Code:
[a2billing]
; CallingCard application
exten => _5.,1,DeadAGI(internalcall.php)
exten => _5.,2,Dial(SIP/${blah})
exten => _5.,3,Hangup

exten => _X.,1,GotoIf($["${EXTEN}" = "6600"]? 4)
exten => _X.,2,DeadAGI(a2billing.php|1)
exten => _X.,3,Hangup
exten => _X.,4,VoicemailMain()
exten => _X.,5,Hangup


And that's it... when some dials 5 and then a short extension (alias), it'll run the SCRIPT and compare with a database, if it exists, it'll assign the real extension to "blah", then it'll dial to that extension.

And that's it =D

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/