Twilio elastic SIP trunks with Avaya system - twilio

Hi if anyone else ever needs help connecting an Avaya IP Office phone system with Twilio Elastic SIP trunking, feel free to reach out to me, we got it to work after some trial and error and the connection seems very good. Will save us some good money.
The final piece to the puzzle for us had to do with the IP address that Twilio sends SIP invites from for incoming calls to the Avaya system. To get this to work in the Avaya we had to set up 4 SIP "Lines" pointing to 4 different "ITSP IP Address" values and 4 "Incoming Call Routes" per DID because Twilio sends from 4 different domestic IP addresses. I did read some documentation about being able to leave the ITSP IP Address blank (0.0.0.0) since we do have the "ITSP Domain Name" populated but that does not seem to work in our situation.
In researching this on the Internet I surprisingly did not find much evidence of Avaya customers ever having to deal with this issue (with or without Twilio), however I did find some examples of some other PBX systems having this issue with connecting to Twilio but those systems seemed equipped to configure multiple IP addresses for a single line.
Thus my question - do any Avaya customers have a suggestion for an alternate configuration to make this work? Anything we could do on our firewall? Twilio does not support sending SIP Invites from a single IP address or via a proxy server address. Fortunately we only have about 10 DID's so this won't be that hard to setup and maintain.

Credit goes to zakabog at the Avaya support forum for answering this, who said:
"Setup the 4 different SIP lines but give the URIs the same incoming group ID, that'll let you use one incoming call route for each DID."
My reply:
"That sounds like a very good idea. I will try that and report back. You are referencing the "SIP URI" tab right that we'd point all 4 of them to line 19 even though we have setup a line 19, 21, 23 and 25, right?"
His reply:
"Exactly, there is the line number and then there's the incoming and outgoing ID, and those numbers don't need to match. So you can have everything share the same incoming or outgoing group ID, it helps keep the ARS and incoming call routes less cluttered."
And my final reply (it worked!):
"Yes that works like a charm. Much better, I don't mind setting up 4 SIP lines but wasn't thrilled about dup'ing the other stuff. Thank you thank you."
I received following question later on the Avaya forum:
"I do need help trying to get this up and running. The main issue is that we can not resolve the ITSP Domain Address field in the Line -> SIP Line -> "ITSP Domain Name" with {our-domain}.pstn.twilio.com
It would be REALLY interesting, step by step, how you would go about getting Twilio to work with 1 SIP trunk on Avaya Office."
My reply:
"Yes, this was my issue too. The way we have it working is by creating 4 SIP lines for each of the 4 Twilio domestic IP addresses (SIP Line tab), 54.172.60.0 through 54.172.60.3. And then using zakabog's suggestion we use only one of these line numbers on the "SIP URI" tab. This allows to only have to create 1 set of "Incoming Call Routes" pointing to that same "Line Group ID" as is shown for the "Incoming Group" and "Outgoing Group" on the "SIP URI" tab. Please note that these call routes will require the "+1" for the "Incoming Number", assuming these are US DID's. Feel free to send me a phone number or email address and I'd be glad to arrange a discussion with you or show you my screen."

You can actually put more than one IP address on the ITSP Proxy address. I did and put a weight to the server:
54.172.60.0w1,54.172.60.1w2,54.172.60.2w3,54.172.60.3w4
This would allow you to create one SIP Trunk line.

Related

Pass extension from Twilio to Asterisk

I am using twilio to manage our IVR, to handle SMS, and for a few other things. After a user calls and goes through the IVR (for example they press 2 for sales or they say they want extension 205) I need it to hand off to Asterisk.
Setting up the trunk isn't my issue. I need to somehow tag it so asterisk knows how to handle the call. If they chose ext 205 on twilio, I need asterisk to automatically ring ext 205.
I am using a minimal version of asterisk basically for sip registration and voicemail and the rest is done by twilio.
Does anyone know if there is a way to do this in code? Or is my best bet to create a different trunk for each extension. That seems like it would get messy.
Correct solution is make IVR on asterisk. This solution also will be MUCH less costly.
But if you really want... On twilio setup via SIP tag
https://www.twilio.com/docs/voice/twiml/sip
set url to sip:0000+exten#your_asterisk_ip
On asterisk setup trunk to twilio server or allowguest=yes and default context to 'goext'
After that goext context something like this
[goext]
exten => _0000XXX,1,Set(ext=${EXTEN:4})
same => n,Dial(SIP/${ext},,o)
0000 replace with some random code, that required for prevent bots calls when allowguest=yes.

I need to be able to transfer call from Twilio Elastic SIP Trunk to Twilio Autopilot

When a customer dials my Twilio number, I need Twilio to first try to call my PBX system. Currently using 3CX. If the call is not answered by a person, I need to find a way to send that call back to Twilio and go to another resource. For my purposes, that resource is Twilio AutoPilot.
Basically, if a human doesn't answer the phone, I want the robot to try and help the customer instead.
The only thing I've been able to come up with so far is to create another Twilio number and have that number be the fallback within the PBX. The problem with that solution is with Twilio, you cannot mask the number to match the CallerID of the customer calling in, and I would really like to be able to know that number. Also you are creating 2 call paths, which could make this an expensive option.
The only other solution I could think of, which would use 3 calls paths, would be to use another provider that does allow me to mask the caller id, and then send that to the Twilio number.
I am not a programmer, I have basic coding knowledge, but just barely.
Any help would be appriciated. Thanks
You can use Programmable Voice with a SIP Dial to initially contact your PBX (it will appear the same way an Elastic SIP Trunk call will appear to your PBX). The easiest way is to use the Connect Call to Widget in Studio. If that call fails, say 3CX returns a 404 - Not Found, Studio can continue to the next Widget via the Connected Call Ended path which can then perform additional steps of your choosing. The CallerID is maintained this way as well.
Elastic SIP Trunking is not designed for this particular call flow but rather a simple conduit from/to the PSTN.
Happy Path
Fallback Path

Cannot make outbound & inbound calls using asterisk 13 (FreePBX) and Twilio

I have had trouble configuring inbound and outbound calls using FreePBX with SIP provider TWilio.
As it stands I cannot make external calls or receive calls from Twilio.
I have monitored TCP port 5060 and can see traffic routed to my address when I engage a call using my number provided through Twilio but from the FreePBX cli I observe the following when I see incoming traffic.
[#DATE] NOTICE[18449]: res_pjsip/pjsip_distributor.c:368
log_unidentified_request: Request from '' failed for '54.252.254.64:5060' (callid: 41822dbe439f067b0ef90f596b3998d2#0.0.0.0) - No matching endpoint found
I have searched the web already for similar issues but have yet to come across anything of use. As this is early testing I have put the system on a DMZ to avoid the NAT firewall.
Note: This is my first post to stack overflow so I may not be correctly following the layout for posting, I apologize in advance. Suggestions are welcome.
Thanks
This is likely a configuration error.
Check the setup guide. But also, I found from another user with the same error that they changed the following:
pj_sip was set to port 5060 instead of chan_sip
Let me know if this helps at all!

Restrict number of user account sign-ups in a period?

I have a web app that requires a user to have an account. This user can then vote 'once' on a specific item. However, some users are signing up for lots of accounts to 'game' the system.
Does anyone have any ideas how you can restrict this type of thing?
Could I restrict number of signups per day per IP address? (what are problems with this?)
Any other suggestions???
You would do yourself one better by restricting the sign-ups to just a single IP address per user. This may not be good if you plan on having families all living under the same roof to have their own accounts, but in most cases this is practical.
Yes, restricting signups per IP is reasonable. I'd probably go with signups per rolling time period (say, a maximum of one new account in any one-hour period per IP). You might also flag suspicious signups (say, more than five per day per IP) for later followup.
You might also restrict users from voting until they've passed some hurdle, similar to SO's reputation system. Prevent poll voting until they've been a user for a week, have posted at least twice, have one friend request, etc.
I remember when I ran a online RPG I flagged when more than 5 or so accounts logged in with the same IP in the same day.
People mention the NAT issue. Read the header x-forwarded-for and compare that to the standard ip address.
If x-forwarded-for is present use this value. Most properly configured NAT routers will populate this field. The only ones that do not are typically anonymous proxies.
If you really are worried about people gaming the system, using a flash bit that uses sockets to connect, and provide say, session id, to the socket listener. You can then compare that with the ip address and x-forwarded for. If it does not match, they are behind an anonymous proxy. You could feel safe to not allow them to create accounts.
This works because most anonymous proxies out there aren't full Socks proxies where all network traffic goes through it, just HTTP. This worked very well for me in the past where we had a contest with voting and folks were using anonymous proxies to game the system.
Instead of limiting by account, you could set up limitations by email address. If users need to provide their email address, you already create one hurdle for them. Make sure they have to respond to a confirmation email to make sure the email address is real. Also keep track of email address and IP address, marking any count as suspicious where a single IP address has e.g. 5 or more email addresses. (In which case you could check those addresses to see if they are somehow related, like all from the same domain or similar names.)
Sure, people can create dozens of email addresses using GMail or Hotmail or even if they have their own private domain. But for many people this is already a bit too much. Basically, if you see 5 email addresses from gmail.com with the same IP address, it's suspicious.
One potential problem is if your users are behind a NAT such as a home router, ISP proxy, or corporate firewall. You will see the same IP for all of them.
Instead of blocking people I would simply record their IPs, create a report of duplicate IPs that you can run periodically to investigate suspicious activity.
In addition you can take a social approach, post the user's IP somewhere. This will provide a gentle warning and disincentive to people who fake accounts, as well as allow your community of users to potentially identify fakers.
I would recommend implementing a different authentication mechanism such as OpenID, or are Alex said, force the users to specify a valid email and send them confirmation links via email before accounts get created.
My preference is OpenID for sure.

Send emails (using Postfix) from two different domains

I have two Ruby on Rails applications, and two virtual domains (mydomain1.com and mydomain2.com)(using Apache+REE+mod_rails).
I use Postfix as mail server.
So I have myhostname = mail.mydomain1.com in main.cf
And that's because why the sender is always mail.mydomain1.com, no matter from which application I send emails.
I need all emails sent from application on virtual domain mydomain1.com have Received: from mydomain1.com, and from second Rails app on mydomain2.com — Received: from mydomain2.com
Is that possible?
Thanks!
Received: headers are added by the receiving server, which is simply doing a reverse DNS lookup on the connecting (sender) IP address. You won't be able to get the result you desire unless you can force Postfix to make its outgoing connections on a specific IP, and then bind an IP per domain to your server.
I guess there is a way to configure Postifx for using virtual accounts for seperate domains. Using this, you should be able to have both of your apps using different settings.
Maybe this helps:
http://howtoforge.org/virtual-users-and-domains-postfix-courier-mysql-centos5.1
or this
http://www.akadia.com/services/postfix_separate_mailboxes.html
Matt
That's a good question, but I don't believe there is an easy answer.
At one point in the past, the author of postfix stated "postfix makes delivery decisions on the basis of the recipient
address only. There is no logic for sender-dependent routing." That was years ago but it may still be true.
Some people have tried using two separate instances of Postfix. There's an article here that might help, although I have not examined it that closely.

Resources