Yate Community Forum

Yate server => Yate server for Google Voice => Topic started by: kcghost on November 18, 2012, 07:51:14 PM

Title: Multiple GV Connections
Post by: kcghost on November 18, 2012, 07:51:14 PM
Need some help configuring YATE to allow multiple Google Voice accounts (one per SIP).

I followed this guide to set up one (which was excellent and works very well): http://yate.null.ro/pmwiki/index.php?n=Main.ConnectingToGoogleVoice

I tried adding another GV (under a different name) to accfile.conf, added another in_line line to regexroute.conf and used :
$sip_username^=username_out

to establish contexts under which to define the large block of outgoing rules, taking care to replace references to GoogleVoice with whichever name I used to define the specific Google Voice account defined in accfile.conf.

The result is only one GoogleVoice seems to work at one time, with both SIP accounts using it.

Any help is very much appreciated.

I am new to using YATE or any other software PBX. I tried configuring Asterisk and Freeswitch to do this but could not find very good information on how to do it. Whether it was finding a good guide or the organization of the software itself I found YATE to be much simpler.
Title: Re: Multiple GV Connections
Post by: Diana Cionoiu on November 18, 2012, 11:02:22 PM
So here is the deal. You have an incoming and an outgoing side.

Routing like regexroute.conf it's the binding force.

So on incoming you have the sip users let's say 101 and 102 and on ougoing gvoice users like gv1 and gv2.

If you want sip user 101 to make calls like gv1 you need to make some context in regexroute ( i have a rough idea, i don't know exactly but this is the principle). That context has to say something like if callerid is 101 pleasesend the call using the account gv1 ( use can use the parameter line for that).
Title: Re: Multiple GV Connections
Post by: td762 on June 18, 2013, 04:46:19 PM
I've spend the last four hours attempting to configure my Yate server to handle multiple Google Voice connections. I've been able to get incoming connections to work fine, but outgoing calls seem to only appear to be called from line=GoogleVoice1. So I'm thinking at this point, it is the outgoing portion of the script that is error. I'd appreciate if someone could shed some light and guide me through this. Appreciate it

Code: [Select]
${username}^$=-;error=noauth
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com;line=GoogleVoice1;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\([1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/1\1@voice.google.com;line=GoogleVoice1;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\(+\?1[1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/\1@voice.google.com;line=GoogleVoice1;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833

^\([1-9][0-9]\{6\}\)$=jingle/MYAREACODE\1@voice.google.com;line=GoogleVoice2;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\([1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/1\1@voice.google.com;line=GoogleVoice2;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\(+\?1[1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/\1@voice.google.com;line=GoogleVoice2;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833

^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com;line=GoogleVoice3;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\([1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/1\1@voice.google.com;line=GoogleVoice3;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\(+\?1[1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/\1@voice.google.com;line=GoogleVoice3;\
ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
Title: Re: Multiple GV Connections
Post by: marian on June 19, 2013, 01:22:09 AM
Hi,

Your called party number matching rules are the same.
The first match will be always used.
That's why the calls go on the first account.
Title: Re: Multiple GV Connections
Post by: td762 on June 19, 2013, 09:12:29 PM
Hi,

Your called party number matching rules are the same.
The first match will be always used.
That's why the calls go on the first account.

Hi Marian, I appreciate your kind reply. Could you specifically point out which line of my script reflects the 'called party number' that I have to change, and also what should this be changed to? Much appreciated.
Title: Re: Multiple GV Connections
Post by: marian on June 20, 2013, 01:38:19 AM
When you set:
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com;line=GoogleVoice1;
^\([1-9][0-9]\{6\}\)$=jingle/MYAREACODE\1@voice.google.com;line=GoogleVoice2;\
the rule in the left hand will match the called party number party.
If you set the same rule the first one will always match before the second one.

If you want to route an incoming call from a sip user registered to yate you may use the following rules:

[default]

${module}^sip$={
    ${username}^USERNAME1$=goto GV_CALL;line=GoogleVoice1
    ${username}^USERNAME2$=goto GV_CALL;line=GoogleVoice2
}

[GV_CALL]
; Set extra parameters for all calls to GV
.*=;ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
; Call
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com



If you want to do something else (e.g. other matching rules for calls) you should tell us what exactly do you want to do.
Title: Re: Multiple GV Connections
Post by: td762 on June 20, 2013, 05:20:35 PM
When you set:
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com;line=GoogleVoice1;
^\([1-9][0-9]\{6\}\)$=jingle/MYAREACODE\1@voice.google.com;line=GoogleVoice2;\
the rule in the left hand will match the called party number party.
If you set the same rule the first one will always match before the second one.

If you want to route an incoming call from a sip user registered to yate you may use the following rules:

[default]

${module}^sip$={
    ${username}^USERNAME1$=goto GV_CALL;line=GoogleVoice1
    ${username}^USERNAME2$=goto GV_CALL;line=GoogleVoice2
}

[GV_CALL]
; Set extra parameters for all calls to GV
.*=;ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
; Call
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com



If you want to do something else (e.g. other matching rules for calls) you should tell us what exactly do you want to do.

Hi Marian,

I truly appreciate your help on this. My goal is quite simple: it's to have my Yate server support multiple GV connections. 

I tried integrating the scripts in your previous reply into regexroute.conf, of course replacing USERNAME1 & USERNAME 2 with 101, 102 respectively. In return, however, I get the following error in my debug:
Code: [Select]
------
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.0.14:5061;branch=z9hG4bK0f221955;received=10.0.0.14
From: "102" <sip:102@10.0.0.2>;tag=0006d74b19c009db314b10b1-44eb6171
To: <sip:SOMEPHONENUMBER@10.0.0.2>
Call-ID: 0006d74b-19c00020-31453866-12616cf2@10.0.0.14
CSeq: 101 INVITE
Server: YATE/4.3.0
Content-Length: 0
------
<sip/1:ALL> YateSIPConnection::YateSIPConnection(0x7ae348,0x7adf38) [0x7ae830]
<sip/1:ALL> NAT address is '(null)' [0x7ae830]
called is SOMEPHONENUMBER
<INFO> Could not classify call from '102', wasted 3405 usec
<INFO> Could not route call to 'SOMEPHONENUMBER' in context 'default', wasted 1661 us                                        ec
<sip/1:MILD> Call rejected error='noroute' reason='No route to call target' [0x7                                        ae830]
<sip/1:ALL> YateSIPConnection::hangup() state=0 trans=0x7adf38 error='noroute' c                                        ode=404 reason='No route to call target' [0x7ae830]
<sip/1:ALL> YateSIPConnection::~YateSIPConnection() [0x7ae830]
<sip:INFO> 'udp:0.0.0.0:5060' sending code 404 0x7e45f0 to 10.0.0.14:5061 [0x668                                        008]
------
SIP/2.0 404 No route to call target
Via: SIP/2.0/UDP 10.0.0.14:5061;branch=z9hG4bK0f221955;received=10.0.0.14
From: "102" <sip:102@10.0.0.2>;tag=0006d74b19c009db314b10b1-44eb6171
To: <sip: SOMEPHONENUMBER @10.0.0.2>
Call-ID: 0006d74b-19c00020-31453866-12616cf2@10.0.0.14
CSeq: 101 INVITE
Server: YATE/4.3.0
Contact: <sip:SOMEPHONENUMBER@10.0.0.2:5060>
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Length: 0
------
<sip:INFO> 'udp:0.0.0.0:5060' received 323 bytes SIP message from 10.0.0.14:5061                                         [0x668008]
------
ACK sip: SOMEPHONENUMBER @10.0.0.2 SIP/2.0
Via: SIP/2.0/UDP 10.0.0.14:5061;branch=z9hG4bK0f221955
From: "102" <sip:102@10.0.0.2>;tag=0006d74b19c009db314b10b1-44eb6171
To: <sip: SOMEPHONENUMBER @10.0.0.2>
Call-ID: 0006d74b-19c00020-31453866-12616cf2@10.0.0.14
Date: Thu, 20 Jun 2013 22:54:10 GMT
CSeq: 101 ACK
Content-Length: 0
------
Title: Re: Multiple GV Connections
Post by: marian on June 24, 2013, 01:12:50 AM
Hi,

Did you removed the line
${username}^$=-;error=noauth
?

Its purpose is to deny all unauthenticated calls: the sip module will not put the username parameter when routing an incoming, not authenticated, call.
Title: Re: Multiple GV Connections
Post by: td762 on June 24, 2013, 12:33:41 PM
Hi,

Did you removed the line
${username}^$=-;error=noauth
?

Its purpose is to deny all unauthenticated calls: the sip module will not put the username parameter when routing an incoming, not authenticated, call.

Marian, I've tried both adding and removing the line "${username}^$=-;error=noauth" and in both cases the below error occurs. Any idea? I might just give up all together and use one connection ony. But I was also hoping in getting this working, so that our existing dialog could benefit any Yate user who might occur in a such similar situation.

Code: [Select]
------
<sip/10:ALL> YateSIPConnection::YateSIPConnection(0x6ceee8,0x6cddc0) [0x6d2710]
<sip/10:ALL> NAT address is '(null)' [0x6d2710]
<regfile:ALL> Authenticating user 101 with password length 4
called is SOMEPHONENUMBER
<INFO> Could not classify call from '101', wasted 1622 usec
<cdrbuild:INFO> Got message 'call.route' for untracked id 'sip/10'
<RegexRoute:ALL> Jumping to context 'GV_CALL' by rule #12 '${username}^101$'
<INFO> Could not route call to 'SOMEPHONENUMBER' in context 'default', wasted 2804 usec
<sip/10:MILD> Call rejected error='noroute' reason='No route to call target' [0x6d2710]
<sip/10:ALL> YateSIPConnection::hangup() state=0 trans=0x6cddc0 error='noroute' code=404 reason='No route to call target' [0x6d2710]
<sip/10:ALL> YateSIPConnection::~YateSIPConnection() [0x6d2710]
<sip:INFO> 'udp:0.0.0.0:5060' sending code 404 0x6d1328 to 10.0.0.14:5061 [0x559008]
------


Here is my current regexroute.conf setup:


Code: [Select]
^.*$=echo called is ${called}
${in_line}GoogleVoice1=;called=101;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833
${in_line}GoogleVoice2=;called=102;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833
${in_line}GoogleVoice3=;called=103;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833

Code: [Select]
${username}^$=-;error=noauth

${module}^sip$={
    ${username}^101$=goto GV_CALL;line=GoogleVoice1
    ${username}^102$=goto GV_CALL;line=GoogleVoice2
    ${username}^103$=goto GV_CALL;line=GoogleVoice3

}

[GV_CALL]
; Set extra parameters for all calls to GV
.*=;ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
; Call
^\([1-9][0-9]\{6\}\)$=jingle/1MYAREACODE\1@voice.google.com
Title: Re: Multiple GV Connections
Post by: td762 on June 24, 2013, 02:12:17 PM
Marian,

After several attempts at trying out different codes in my script, I'm happy to announce that I've gotten it to work. I'm unsure of whether any portions of my script has any conflicting violations, but I'm truly excited in getting this to work. I've attached the portion of regexroute.conf for those who wants to get multiple GV accounts on their Yate server. Big thanks goes to Marian for his/her work in providing the scripts to get this to work.

REGEXROUTE.CONF

Code: [Select]
^.*$=echo called is ${called}
${in_line}GoogleVoice1=;called=101;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833
${in_line}GoogleVoice2=;called=102;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833
${in_line}GoogleVoice3=;called=103;jingle_version=0;jingle_flags=noping;dtmfmethod=rfc2833

Code: [Select]
[default]
${username}^$=-;error=noauth

${module}^sip$={
    ${username}^101$=goto GV_CALL;line=GoogleVoice1
    ${username}^102$=goto GV_CALL;line=GoogleVoice2
    ${username}^103$=goto GV_CALL;line=GoogleVoice3

}

[GV_CALL]
; Set extra parameters for all calls to GV
^\([1-9][0-9]\{6\}\)$=jingle/1YOURAREACODE\1@voice.google.com;\
 ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\([1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/1\1@voice.google.com;\
 ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833
^\(+\?1[1-9][0-9]\{2\}[1-9][0-9]\{6\}\)$=jingle/\1@voice.google.com;\
 ojingle_version=0;ojingle_flags=noping;redirectcount=5;checkcalled=false;dtmfmethod=rfc2833