Sunr1ses / google-voice-sipsorcery-dialplans

Automatically exported from code.google.com/p/google-voice-sipsorcery-dialplans
1 stars 0 forks source link

Dial Plan Help (See Inside) #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I was wondering...

Let's say I have a few Google Numbers in other area codes (other than my 
"home area code"), and let's say that I call numbers in other area codes 
too.

Is it possible to use those other numbers only if I were dialing specific 
area codes?

EX:

I call 1-(606)-000-0000, but I don't want the other person to see my "home 
area code of 304, instead I want them to see my Google Number in their area 
code (if I did not reach them, and then they decide to call me back, it 
would cost them long distance).

I have numbers in the following area codes (I included my "home area code" 
too):
----- 304 (My "Home Area Code", where all other area code calls should go)
----- 606 (My 606 Number should show up, not my 304 one)
----- 615 (My 615 Number should show up, not my 304 one)
----- 864 (My 864 Number should show up, not my 304 one)

My 304 Number is the one that shows up when I make calls to all other area 
codes, but if I were to make a call to one of the other three, I'd like it 
if I could get it to use that other number in that area code.

I'm not looking for caller-id spoofing, but instead using the 
GoogleVoiceCall function of SIPSorcery to use another number for a specific 
area code.

I hope this makes sense.

Original issue reported on code.google.com by XANAVi...@gmail.com on 27 Feb 2010 at 6:15

GoogleCodeExporter commented 9 years ago
I just want to say, this is of no true importance.

The only reason I brought this up was because my out-of-state relatives were 
not 
happy with being charged long distance to call me, so, using a few of my other 
Gmail 
accounts, I acquired numbers in their area codes so they could use them to call 
me.

But, everytime I would call them it would show my home area code, which costs 
them 
long distance since they like to call me back based on my number that I called 
from, 
and I got those other numbers so they could use them instead of my main one. 

There is probably some way to use the GoogleVoiceCall function in SIPSorcery to 
pass 
along details for another Google Account, but I haven't yet figured it out.

Original comment by XANAVi...@gmail.com on 27 Feb 2010 at 6:26

GoogleCodeExporter commented 9 years ago
It's not a big deal, but you'll have to write a bit of your own code. A good 
starting 
point is:

http://www.mysipswitch.com/forum/viewtopic.php?t=1678

You'll need to create "account descriptors" for each of your GV accounts and 
then 
pass this descriptor as a parameter to gvcall. Well, it's easier to explain by 
example:

HomeAccount = [ 
   ['me1@gmail.com','pass1','1747xxxxxxx','.*',7,15], 
]  

Area303 = [ 
   ['me1@gmail.com','pass1','1747xxxxxxx','.*',7,15], 
]  

Area212 = [ 
   ['me2@gmail.com','pass2','1747xxxxxxx','.*',7,15], 
]  

def gvcall(num,descriptor,acnt) 
  a = descriptor[acnt % descriptor.length]           # fetch params 
  sys.GoogleVoiceCall(*((a[0,3] << num) + a[3,10]))  # insert number as 4th param 
end

Of course, each descriptor may contain more than 1 entry (if you have several 
callback numbers for this particular GV account). Then you pick descriptor 
corresponding to callee's area code and pass it to gvcall, like that:

r = Time.now.to_i

case num

  when /^1303/
    2.times { |x| gvcall num, Area303, r + x }

  when /^1212/
    2.times { |x| gvcall num, Area212, r + x }

  else
    2.times { |x| gvcall num, HomeAccount, r + x }
end

Original comment by mte...@gmail.com on 27 Feb 2010 at 3:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
None of my accounts currently have any more than 1 callback number right now.

So, what I would put in my dialplan code is:

Doing it this way, would I have to change the way I enter phone numbers to 
include 
the area code and the 1 at the beginning, or can I still do 7-digit dialing to 
reach 
numbers in my HomeAreaCode?
Or does the other unchanged parts of the dialplan do what they normally do and 
modify 
numbers to do that for me?

HomeAreaCode = [ 
   ['me1@gmail.com','pass1','1747xxxxxxx','.*',7,15], 
]  

606AreaCode = [ 
   ['me2@gmail.com','pass2','1747xxxxxxx','.*',7,15], 
]  

615AreaCode = [ 
   ['me3@gmail.com','pass3','1747xxxxxxx','.*',7,15], 
]  

864AreaCode = [
   ['me4@gmail.com','pass4','1747xxxxxxx','.*',7,15],
]
---------------------------------

I can't tell if this part needs to be modified, though.
def gvcall(num,descriptor,acnt) 
  a = descriptor[acnt % descriptor.length]           # fetch params 
  sys.GoogleVoiceCall(*((a[0,3] << num) + a[3,10]))  # insert number as 4th param 
end
----------------------------------

I'm not sure where to place this.
Or whether it should stay the same.
r = Time.now.to_i

And this will go in the section along with the SIPBroker code (as in right 
after 
it), right?
case num

  when /^1606/
    2.times { |x| gvcall num, 606AreaCode, r + x }

  when /^1615/
    2.times { |x| gvcall num, 615AreaCode, r + x }

  when /^1864/
    2.times { |x| gvcall num, 864AreaCode, r + x }

  else
    2.times { |x| gvcall num, HomeAreaCode, r + x }
end

Of course I haven't yet put any of this in (I wanted to finalize it here first).

Original comment by XANAVi...@gmail.com on 1 Mar 2010 at 1:48

GoogleCodeExporter commented 9 years ago
> Doing it this way, would I have to change the way I enter phone numbers to 
> include the area code and the 1 at the beginning, or can I still do 7-digit
> dialing to reach numbers in my HomeAreaCode?

We convert dialed numbers into international (ENUM) format: country code 
followed by 
area code and then phone number. Example: 12125551212. The code above deals 
with 
converted (normalized, ENUM-formatted, whatever you call it) numbers.

Therefore, in no way the changes will affect your dialing rules. You dial 
7-digit 
number, we convert it to "1 + home_area_code + number" and then we dial it 
using your 
HomeAccount credentials.

That was a simple question. The other questions... I'm not sure what to do. 
Judging 
by the way you're trying to modify the code (606AreaCode is illegal identified, 
Ruby 
constant names must begin with uppercase letter, like in AreaCode_606), your 
knowledge of the language is very limited. You can't write code unless you know 
the 
language. So, either I should write the code for you or send you to the books.

I don't mind writing the code but I'm afraid it would contradict with the 
purpose of 
this site. It's to give people jump-start (copy/paste and go!). You're asking 
for 
something more complicated.

And yet, there are many variations. You have 1 callback number per account, the 
others may have several. You're looking for 1:1 relations between area codes 
and GV 
accounts while some may want to use, say, their GV number in 347 area code to 
call 
all NY numbers (area codes 212, 718, 347, 646, 516). It's impossible to 
implement all 
this and yet keep the code simple to configure.

May I suggest that you read the Ruby docs?

Original comment by mte...@gmail.com on 1 Mar 2010 at 3:38

GoogleCodeExporter commented 9 years ago
Of course my knowledge of Ruby is limited... I've not been working with it for 
a long 
time (I only started shortly after I received the invite to Google Voice, 
around the 
end of December of last year).

Unlike you, I have hardly any experience.

I'm not asking for the code to be written for me.

As to those display names, I wasn't planning to put them in in exactly that way 
that 
I wrote them (as that would defeat my purpose of "finalizing" them here).
There is no need to take the display names (Identified name, Ruby Constant 
name, 
ect.) as being exactly like the finished product.

I know you typed more than I have responded to, but some of it I just don't 
know what 
to say back.

Original comment by XANAVi...@gmail.com on 1 Mar 2010 at 4:43

GoogleCodeExporter commented 9 years ago
@mtelis

Do you know where I can find the detailed description of the RUBY Dial Plan 
syntax 
on line? I need to learn more.

Thanks,

Original comment by victor...@gmail.com on 5 Mar 2010 at 9:15

GoogleCodeExporter commented 9 years ago
There is a help page on SS website:

http://www.sipsorcery.com/help/dialplans

You can also read this topic (it's an old one, from MySIPSwitch times:

http://www.mysipswitch.com/forum/viewtopic.php?t=399

And of course, you can refer to dialplan helper C# code.

Original comment by mte...@gmail.com on 6 Mar 2010 at 5:21

GoogleCodeExporter commented 9 years ago

Original comment by mte...@gmail.com on 24 Mar 2010 at 8:01

GoogleCodeExporter commented 9 years ago

Original comment by easter...@gmail.com on 26 Mar 2010 at 2:43