GoogleVoice call and outgoing only dialplan

Catalog of dial plans
Post Reply
davidnewton
Posts: 179
Joined: Thu Aug 27, 2009 3:00 am

GoogleVoice call and outgoing only dialplan

Post by davidnewton » Thu Aug 27, 2009 5:53 pm

I have a user case as following: I have one ATA and one softphone installed on PC. I would like to use the ATA to do both incoming and outgoing calls, but the softphone to do the outgoing calls only. This way, I can avoid ringing on both ATA and the software phone. For the outgoing calls, I would like to use googlevoicecall() to make fre calls in US. In Sipsorcery, I tried to make 2 usernames in one sipsorcery account, and 2 dialplans, one username uses the dialplan which have both incoming and outgoing with the ATA binded to it, another username uses the dialplan with outgoing only with the softphone binded. I tried the following dialplan, but it does not work. I think it is because that the GoogleVoiceCall needs both incoming (for callback) and outgoing. The solution might be in the incoming process section, the dialplan should identfy the callID and if it is Google callback, then accept it, otherwise ignore. I am not very sure what kind of callID the google callback uses in the GoogleVoiceCall() function. Please give me some hint about this case. Thanks in advance.

BTW, thanks everyone especially Aaron for giving us such a good service.

Code: Select all

#Ruby - Default (works) 
# Dial Plan for David Newton 
# If you need help, please post in our forum 
# http://www.mysipswitch.com 

# SIP tracing : true or false 
sys.Trace = false 
sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.") 

if sys.In then 
 # Do your INCOMING call processing customisations here. 
        sys.Respond(400, "#{sys.Username} Not available") 
        sys.Log("No incoming call") 
else 
 # Do your OUTGOING call processing customisations here. 
  GV_email = "xxxxxxx@gmail.com" 
  GV_pwd = "xxxxxxx" 
  G5_SIPnum = "1747xxxxxxx" 
  areaCode = "713" 

  case req.URI.User 
    when /^[1]?(976|900|809)/ 
      sys.Log("Calls to #{req.URI.User} not allowed") 
      sys.Respond(488, "Call not allowed") 
    when /^00/ then sys.Dial("voip_ms") 
    when /^1\d{10}/                        # 1+10 digits 
      sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"#{req.URI.User.to_str[0,11]}") 
    when /^\d{10}/                         # 10 digits 
      sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"1#{req.URI.User.to_str[0,10]}") 
    when /^\d{7}/                          # 7 digits 
      sys.GoogleVoiceCall(GV_email,GV_pwd,G5_SIPnum,"1#{areaCode}#{req.URI.User.to_str[0,7]}") 
  else 
    sys.Log("Calls to #{req.URI.User} not allowed") 
    sys.Respond(488, "Call not allowed") 
  end
end

LHM
Posts: 164
Joined: Tue Jul 28, 2009 7:11 pm

Post by LHM » Thu Aug 27, 2009 6:11 pm

From Site admin:

"Hi all,

The final purpose of this sub forum is to list working Ruby Dial Plans, each corresponding to a specific Use Case. They will be followed by comments/explanations.

Do not create a new thread here if you have a question about Ruby, please, use the Technical Support forum.

If you have a dial plan which is working fine, do not hesitate to create a new thread in this subforum, to post and comment it. Just make sure that a very similar dial plan is not already there.
Other users may comment it and maybe suggest improvements."

I don't mean to offend.

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Post by MikeTelis » Fri Aug 28, 2009 9:35 pm

While the admins are not in a hurry to move this thread, I risk to add my 2c worth comment :)
I would like to use the ATA to do both incoming and outgoing calls, but the softphone to do the outgoing calls only.
Typically softphones have an option (checked by default) to register with proxy and receive incoming calls. Why don't you just uncheck this option in your softphone? :) You'll be able to make outgoing calls but your softphone won't ring on incoming, exactly what you wanted.

Post Reply