Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 2:53 pm
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: strange characters in sip Uri
PostPosted: Thu Jul 17, 2014 6:15 am 
Offline

Joined: Thu Apr 21, 2011 5:22 pm
Posts: 106
Hi Guys,

I am using a sip client with a2billing. After an ios update, numbers that are dialed with any space in them comes to a2billing with some strange characters instead of the spaces.

E.g a number stored on my phone as 011 237 7840141 comes to my a2billing agi as

Executing [011▒237▒7840141@a2billing:1] Answer("SIP/XXXXXX-00002fca", "2000") in new stack

How do i clean up the number to remove those strange characters?


Top
 Profile  
 
 Post subject: Re: strange characters in sip Uri
PostPosted: Sun Jul 20, 2014 11:08 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
Just edit out the spaces in your phone contact.

Logically the server should not have to guess where you want to call , but only to check if the number is valid or not.


Top
 Profile  
 
 Post subject: Re: strange characters in sip Uri
PostPosted: Wed Jul 23, 2014 6:06 am 
Offline

Joined: Thu Apr 21, 2011 5:22 pm
Posts: 106
Quote:
Just edit out the spaces in your phone contact.


Not possible on iphone.


Top
 Profile  
 
 Post subject: Re: strange characters in sip Uri
PostPosted: Wed Jul 23, 2014 9:17 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
I see what you mean. I handle that sort of thing in a different way, but for you this should help you out.

Put in /var/lib/asterisk/agi-bin/fixdestination.php , change ownership to asterisk if necessary.
Code:
#!/usr/bin/php -q
<?php
    include("/usr/local/src/billing/common/lib/phpagi/phpagi.php");   //change this
    $agi = new AGI();

    //remove spaces and dashes from asterisk "EXTEN"
    $agi->request[agi_extension] = str_replace(' ', '', $agi->request[agi_extension]);
    $agi->request[agi_extension] = str_replace('-', '', $agi->request[agi_extension]);

    //remove spaces and dashes from dialed num
    $agi->request[agi_dnid] =  str_replace(' ', '', $agi->request[agi_dnid]);
    $agi->request[agi_dnid] =  str_replace('-', '', $agi->request[agi_dnid]);

    $agi->set_variable('FIXEDEXTEN',$agi->request[agi_extension]);
    $agi->set_variable('FIXEDDNID',$agi->request[agi_dnid]);

?>


Then somewhere in your dialplan for example;
Code:
exten => _X.,1,AGI(fixdestination.php)
exten => _X.,n,Set(CALLERID(dnid)=${FIXEDDNID})
exten => _X.,n,GoTo(a2billing-bill-outbound,${FIXEDEXTEN},1)


if the characters you want to remove are not actually spaces then this will not work and additional coding is required.


Top
 Profile  
 
 Post subject: Re: strange characters in sip Uri [ Resolved ]
PostPosted: Thu Jul 24, 2014 4:26 am 
Offline

Joined: Thu Apr 21, 2011 5:22 pm
Posts: 106
Thanks Vulcan. I tried that but it didn't work. I found this dialplan command, FILTER which did the trick.


Code:
exten => _X.,1,Set(SAFE_EXTEN=${FILTER(0-9,${EXTEN})})


This is actually recommended if your sip client will be dialing only digits. It mitigates dialplan injection.


Top
 Profile  
 
 Post subject: Re: strange characters in sip Uri
PostPosted: Thu Jul 24, 2014 12:13 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
Good to know. In that case you should filter the CALLERID(dnid) because it will also have the bad number coming from the address book.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 
Predictive Dialer


All times are UTC


Who is online

Users browsing this forum: No registered users and 11 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