Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Fri Mar 29, 2024 10:51 am
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Mon Jun 01, 2009 10:18 pm 
Offline

Joined: Mon May 11, 2009 11:12 am
Posts: 20
Hello

Actually, the call_sip_iax_buddy function searches for the SIP-IAX friend related to the cardalias :

common/lib/Class.A2Billing.php :
$QUERY = "SELECT name FROM cc_iax_buddies, cc_card WHERE cc_iax_buddies.name=cc_card.username AND useralias='".$this->destination."'";
$QUERY = "SELECT name FROM cc_sip_buddies, cc_card WHERE cc_sip_buddies.name=cc_card.username AND useralias='".$this->de
stination."'";

In case we have more than one SIP-IAX friend for a given card, the function does not permit to call another SIP-IAX friend than the one which matches cc_sip_buddies.name=cc_card.username.

I suggest that the call_sip_iax_buddy would call for the SIP-IAX friends instead of the cardalias :
$QUERY = "SELECT name FROM cc_sip_buddies WHERE name='".$this->destination."'";

and the callerid should not be the useralias anymore :
// $agi->set_callerid($this->useralias);


Maybe I missed something in the code and in that case, I apologize for this request.

Best Regards


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Thu Jun 11, 2009 9:52 am 
Offline

Joined: Mon May 11, 2009 11:12 am
Posts: 20
Hello

In the beginning, my purpose was to charge friend-to-friend communications...
This forum helped me to do it (with a special rate and options well set in agi_conf)

BUT in case there are several sip-iax accounts related to the same card (via the accountcode field), the query fails... So I modified a little the query in Class.A2Billing.php to catch the sip-iax account instead of the cardalias (see above).
This modification should have no effect for those who already use this function with one-to-one relation between cards and sip-iax accounts.

Now I wanted that the sip-iax friends communications between 2 sip-iax accounts belonging to a same card would be free of charge.
I modified again the query to get what I wanted.

Here are my modifications (on V1.4_RC1).
Code:
Class.A2Billing.php :
line 1066:
$this->save_redial_number($agi, $this->destination); // $agi was missing in the function call
line 1072:
$QUERY = "SELECT name FROM cc_iax_buddies WHERE accountcode='".$this->accountcode."' AND name='".$this->destination."'";
line 1084:
$QUERY = "SELECT name FROM cc_sip_buddies WHERE accountcode='".$this->accountcode."' AND name='".$this->destination."'";
line 1114-1115:
$agi->set_callerid($this->callerid);  // I wanted the callerID to be used insted of the useralias...
$this -> debug( DEBUG, $agi, __FILE__, __LINE__, "[EXEC SetCallerID : ".$this->callerid."]");


Areski, in case you accept them and if you could confirm that there are no other consequences elsewhere in the application, I think it would be convenient to add an option in the agi_conf/sip_iax_friends parameter :
"No" for No Free calls between sip-iax friends
"Limited" for allowing the free calls on ly between sip-iax friends belonging to the same card
"Yes" for allowing the free calls between all the sip-iax friends

Cyril


Last edited by cvinh on Fri Jun 12, 2009 1:39 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Thu Jun 11, 2009 5:19 pm 
Offline

Joined: Sun Mar 12, 2006 2:49 pm
Posts: 954
Location: Barcelona
Quote:
$QUERY = "SELECT name FROM cc_iax_buddies WHERE accountcode='".$this->accountcode."' AND name='".$this->destination."'";


This means that we have to dial the account number and not the cardalias, as the field name is provisioned with the account code value.

This is changing the way the feature work.

Yours.
/Areski


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 4:34 am 
Offline

Joined: Mon May 11, 2009 11:12 am
Posts: 20
yes

but do you agree that if the card has multi sip-iax friends the feature cannot work as it was before... ?

and that this change should not be harmless for users that already use the function (as by default the cardalias equals to the accountcode) ?

Regards
C.


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 7:22 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

Quote:
...as by default the cardalias equals to the accountcode


I'm not sure that the cardalias should = the the accountcode - The accountcode should be the same as the A2Billing card number.

The issue is that to dial with the account number creates a security issue, as this number is used for authentication in calling card services.

The more elegant way of doing it maybe to create a DID or extension, and direct that number to the account number. This would be better done within a2billing.php, as this keeps the call inside A2Billing, rather than sending it out via a local trunk, then bringing it back into A2Billing as a DID.

Doing the extension to extension dialling in this way means that you can select extension numbers, make charges for internal calls, and do everything without custom code.

Joe


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 1:37 pm 
Offline

Joined: Mon May 11, 2009 11:12 am
Posts: 20
Joe, Thank you for replying

Quote:
I'm not sure that the cardalias should = the the accountcode - The accountcode should be the same as the A2Billing card number.

The issue is that to dial with the account number creates a security issue, as this number is used for authentication in calling card services.


You're right, I made a mistake, when I create a new customer/sip-iax friend, it is the callerid field which is equal to the cardalias.
So the card number is not used.

The accountcode is only used in the query.
In the case there are several sip_iax_friends, we must use a WHERE that matches with the card the caller and the callee belong to (in order to make the call free of charge only for friends who belongs to the same card). The WHERE should also be done via the id_card...


The correct queries would be :
Code:
line 1072:
$QUERY = "SELECT callerid FROM cc_iax_buddies WHERE accountcode='".$this->accountcode."' AND callerid='".$this->destination."'";
or
$QUERY = "SELECT callerid FROM cc_iax_buddies WHERE id_cc_card='".$this->id_card."' AND callerid='".$this->destination."'";

line 1084:
$QUERY = "SELECT callerid FROM cc_sip_buddies WHERE accountcode='".$this->accountcode."' AND callerid='".$this->destination."'";
or
$QUERY = "SELECT callerid FROM cc_sip_buddies WHERE id_cc_card='".$this->id_card."' AND callerid='".$this->destination."'";

Which one is the best according to you ? (both don't seem to have an index in the db)

Quote:
The more elegant way of doing it maybe to create a DID or extension, and direct that number to the account number. This would be better done within a2billing.php, as this keeps the call inside A2Billing, rather than sending it out via a local trunk, then bringing it back into A2Billing as a DID.

Doing the extension to extension dialling in this way means that you can select extension numbers, make charges for internal calls, and do everything without custom code.


BTW, my Call stays in A2B (in this exemple the callee's callerid is 60025 called from 60022):

Code:
    -- ast_get_srv: SRV lookup for '_sip._UDP.callcentric.com' mapped to host alpha3.callcentric.com, port 5080
  == Using SIP RTP CoS mark 5
    -- Executing [55560025@a2billing:1] DeadAGI("SIP/60022-b7d8f3c8", "a2billing.php,1") in new stack
[Jun 12 03:19:21] WARNING[21554]: res_agi.c:3032 deadagi_exec: DeadAGI has been deprecated, please use AGI in all cases!
    -- Launched AGI Script /usr/share/asterisk/agi-bin/a2billing.php
    -- AGI Script Executing Application: (DIAL) Options: (SIP/60025,60,iL(3600000:61000:30000))
    -- Limit Data for this call:
       > timelimit      = 3600000
       > play_warning   = 61000
       > play_to_caller = yes
       > play_to_callee = no
       > warning_freq   = 30000
       > start_sound    =
       > warning_sound  = timeleft
       > end_sound      =
  == Using SIP RTP CoS mark 5
    -- Called 60025>
    -- SIP/60025-b7d4e728 is ringing


Regards

Cyril


Last edited by cvinh on Fri Jun 12, 2009 1:51 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 1:49 pm 
Offline

Joined: Sun Mar 12, 2006 2:49 pm
Posts: 954
Location: Barcelona
The right solution should be :

Code:
SELECT name FROM cc_iax_buddies, cc_card WHERE cc_iax_buddies.id_cc_card=cc_card.id AND useralias=

Code:
SELECT name FROM cc_sip_buddies, cc_card WHERE cc_iax_buddies.id_cc_card=cc_card.id AND useralias=


This will return all the SIP/IAX config created, but this won't be enough to send the call to them,
other changes will be necessary.


Yours,
/Areski


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 1:54 pm 
Offline

Joined: Sun Mar 12, 2006 2:49 pm
Posts: 954
Location: Barcelona
I committed the change above in r2117
but still all the logic to browse the result and call the client need to be rewritten.

Yours,
/Areski


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 3:00 pm 
Offline

Joined: Mon May 11, 2009 11:12 am
Posts: 20
areski wrote:
Code:
SELECT name FROM cc_sip_buddies, cc_card WHERE cc_iax_buddies.id_cc_card=cc_card.id AND useralias=


Little mistake isn't it ? :
SELECT name FROM cc_sip_buddies, cc_card WHERE cc_sip_buddies.id_cc_card=cc_card.id AND useralias=

C.


Top
 Profile  
 
 Post subject: Re: [call_sip_iax_buddy] sip-iax friend instead of cardalias
PostPosted: Fri Jun 12, 2009 3:10 pm 
Offline

Joined: Sun Mar 12, 2006 2:49 pm
Posts: 954
Location: Barcelona
good catch :wink:
fixed in r2118


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


All times are UTC


Who is online

Users browsing this forum: No registered users and 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group