Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 8:42 pm
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: DID Handling
PostPosted: Sun Nov 18, 2007 4:02 pm 
Offline

Joined: Mon Oct 01, 2007 10:44 pm
Posts: 230
Location: Bovey, Devon, UK
I wan't happy with the DID handling in a couple of areas.

First, when the user is presented with options to divert the call, without the tech (SIP, IAX) the call would fail.

Second, if the last destination is the user's own phone, logic would dictate that this would be a good point to go to voicemail.

I've made some changes to Class.A2Billing.php. I've tested it and it seems fine.

Thoughts anyone?

Check tech is included
Quote:
Around line 1004

//# Channel: technology/number@ip_of_gw_to PSTN
// Dial(IAX2/[email protected]/s@default)
// DIAL OUT
/Nik
// Check to see if technology has been set, if not set to SIP as default
$tech_SIP_check="SIP/";
$tech_IAX_check="IAX/";

if(stristr($dialstr,$tech_SIP_check)==0 && stristr($dialstr,$tech_IAX_check)==0)
$dialstr = "SIP/".$dialstr;

$this -> debug(WRITELOG, $agi, __FILE__, __LINE__, "[A2Billing] DID call friend: Dialing '$dialstr' Friend.\n");

$myres = $agi->exec("DIAL $dialstr");

// End of Mod - Nik




Second Mod looks to see if last call on list and sends to VM

Quote:
Around line 1040
//# Ooh, something actually happend!
$this -> debug( WRITELOG, $agi, __FILE__, __LINE__, "DIAL STATUS - $dialstatus");

Insert following

//Mod here -- Nik
// IF this is the last entry and it's not answer, then go to voicemail

if (count($listdestination)==$callcount & $dialstatus != "ANSWER"){
$answeredtime=0;
// The following section will send the caller to VoiceMail with the unavailable priority.
$this -> debug( WRITELOG, $agi, __FILE__, __LINE__, "DIVERT TO VOICEMAIL");
$buddy="u".$this->destination;
$agi-> exec(VoiceMail,$buddy);
$this -> debug( WRITELOG, $agi, __FILE__, __LINE__, "DIVERT TO VOICEMAIL ($buddy)");
break;
}
// End Mod


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 22, 2007 9:04 am 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
I think both of your suggestions would be improvements to A2B, but they could use a little more work.
middletn wrote:
First, when the user is presented with options to divert the call, without the tech (SIP, IAX) the call would fail.
Code:
$tech_SIP_check="SIP/";
To save on memory I don't think there's any need to place the prefixes you're going to check into variables; just use literals. Also I believe the channel technology is case-sensitive so we can use the faster strpos() PHP function to match. It's quite possible other technologies like ZAP or H323 may be used. Like this perhaps:
Code:
if (strpos($dialstr,'SIP/')===FALSE && strpos($dialstr,'IAX2/')===FALSE && strpos($dialstr,'ZAP/')===FALSE &&
strpos($dialstr,'H323/')===FALSE && strpos($dialstr,'OH323/')===FALSE && strpos($dialstr,'Local/')===FALSE)
{
    $dialstr = "SIP/".$dialstr;
}

Quote:
Second, if the last destination is the user's own phone, logic would dictate that this would be a good point to go to voicemail.
Are you sure you want to be using '$buddy="u".$this->destination;' rather than useralias or username as discussed here.
I like your placement of it though, before all the other tests to minimize the duplication. :idea:
Razametal's post in the same thread to support voicemail when SIP friend calling could use the same treatment I think.

Added after 31 minutes:

Actually even better code for the technology matching would probably look like:
Code:
$dialtech = explode('/', strtoupper($dialstr), -1);    # grab everything before the first / and convert to upper case
if (!in_array($dialtech[0], array('SIP','IAX2','ZAP','H323','OH323','LOCAL','MISDN','SKINNY','MCGP')))
{
    $dialstr = 'SIP/'.$dialstr;
}


Added after 19 minutes:

Or probably quicker and definately less memory hungry without resorting to using a temporary array:
Code:
// ENSURE A VALID CHANNEL TECHNOLOGY IS PRESENT, OR DEFAULT TO SIP (thanks middletn)
if (!in_array(strtoupper(substr($dialstr, 0, strpos($dialstr,'/'))), array('SIP', 'IAX2', 'ZAP', 'H323', 'OH323', 'LOCAL', 'MISDN', 'SKINNY', 'MCGP')))
{
   $dialstr = 'SIP/'.$dialstr;
}


Last edited by stavros on Thu Feb 14, 2008 10:00 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 24, 2007 9:58 pm 
Offline

Joined: Mon Oct 01, 2007 10:44 pm
Posts: 230
Location: Bovey, Devon, UK
I agree, your coding is a lot neater than mine, but I'm still learning PHP :)

To be honest, this whole interface could do with cleaning up.

Thoughts are::

Divert on time
Divert to multiple numbers (create call queues)
Simplfy the user interface as it's a little confusing (add voicemail as an option)
Make add numbers the default option instead of buy a new DID

regards


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 25, 2007 1:23 am 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
middletn wrote:
Make add numbers the default option instead of buy a new DID
Ah! Cool! I never did figure out what 'add numbers' was for, I thought it was just a duplicate of 'buy new number'.
What do you use it for?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 29, 2007 11:07 pm 
Offline

Joined: Mon Oct 01, 2007 10:44 pm
Posts: 230
Location: Bovey, Devon, UK
Add numbers translates to add destinations

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group