Asterisk SIP channel format - asteriskami

At some point I found this format for the channel in the AMI Originate command:
SIP/user::::tcp#host:port
I need the request URI to be user#host:port, but I need to send it out a specific SIP peer. I can't seem to find that format again by googling. Does anyone have any idea?
Tried SIP/peer/user, but the request URI was wrong.

Related

Twilio's RAW HTTP POST request for status updates and message responses with all attribute names?

The documentation Twilio has on their website doesn't contain raw POST bodies, and it has conflicting sources on how the attributes are named/which attributes are included in the body.
Field names and their casing don't match:
https://www.twilio.com/docs/api/twiml/sms/twilio_request#request-parameters
https://www.twilio.com/docs/api/rest/message
Should I expect Message Resource type for all of their POST requests to our URLs(Status Updates and Message Responses) ?
Should I expect only the field names advertised on their Twilio's request page?
Do they provide all parameters or any additional parameters in their request not advertised on the documentation(Twilio's request)
I'm assuming they would also provide "MessageStatus" field in their POST requests, but I don't see it on all documentation pages.
The headers in their requests?
Twilio developer evangelist here.
Of the two pieces of documentation you are referring to there, only one is about the request Twilio makes to you when you receive an SMS message. The other is the Messages resource of the REST API.
So, in answer to your questions:
1) The attributes you receive are the ones described in the request documentation. If you want to confirm this, then I recommend setting your webhook URL to a Request Bin which is an easy way to inspect a webhook request like this. Alternatively, if you are using ngrok to test webhooks locally, then check out the ngrok dashboard which also allows you to inspect (and replay) requests.
2) Yes!
3) There are no extra parameters that I know of.
4) MessageStatus is not included. You can look it up using the Messages resource, but in my experience at the point of receiving the webhook the status is "receiving". Once you are done processing the webhook the status changes to "received".
5) The headers are mostly standard. There are extra ones for security, such as the X-Twilio-Signature header. Again, I recommend inspecting a request with Request Bin or ngrok to fully understand the entire request.
Let me know if this helps at all.
Edit
The Content-Type header for POST requests from Twilio is application/x-www-form-urlencoded.
In a message status callback, the parameters are all the usual parameters plus the MessageSid, a MessageStatus, and if relevant an ErrorCode.

Twilio URL example for sending MMS

I'm a very new programmer and am messing around with creating URL's to send SMS or MMS messages via Twilio (my application is for home automation where if my camera detects motions, I want to send a still image to an MMS number via a URL).
Can someone post the format for sample URL for an MMS message that I can paste in a browser?
For example, if I have a To parameter of To=+7145551212 and a From parameter of From=+7145551111 and MediaURL=http://test.com/image.jpg, what would the format of the URL need to be?
I have my Account SID and AuthToken as well. Just need an example of what a completed URL would look like so I can work backwards from there.
Thanks!
Paul
If I'm understanding you correctly, I think it would be this :
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages
And then your parameters need to be in the POST body of the request, like
To=+7145551212&From=+7145551&MediaURL=http://test.com/image.jpg
But Brodan's comment is correct- you can't do this through just pasting a URL into your browser, because it's a POST request. You could use cURL, something like this :
curl --data "To=+7145551212&From=+7145551&MediaURL=http://test.com/image.jpg" https://api.twilio.com/2010-04-01/Accounts/123456/Messages
But your best option would really be to use one of the Twilio helper libraries. Here's a link to their description of the endpoint, they have examples of using those libraries in a variety of languages.
Note : I have never used Twilio myself.

XML not generating for twilio in ruby file

I am building a phone-number verification app using Twilio. Following this tutorial closely. However, I am unable to generate a valid XML like how this specific page says. How can I fix this?
My main problem is that I am unable to get Twilio to read the TwiML document which I set up in twilio-quickstart.rb. I have run ruby twilio-quickstart.rb and exposed my port using ngrok. On the browser, I can see the words in TwiML tags but in the call, keep getting Application Error. Twilio logs indicate HTTP retrieval failure with this message.
An attempt to retrieve content from
http://adfsfsdf.ngrok.io/hello-monkey returned the HTTP status code
404.
Suspecting an error with the way the XML document is generate (I may be wrong)
In the browser...Instead of getting this...
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello Monkey</Say>
</Response>
I am getting this...
Press 1 to verify your number
Whereas one of the example urls given shows the xml page clearly.
Just to be sure - I have set up my ngrok properly.
How can I generate the XML document properly? Or, how I can overcome the HTTP retrieval error that Twilio logs are showing?
Twilio developer evangelist here.
There are a few things that could be going on here, so I might not be right to start with, but we can work to get this sorted for you.
The error you're getting from Twilio is a 404, meaning that Twilio can't find the URL it's looking for. If you can hit your own endpoint and get a response then there is probably something wrong between you and Twilio.
I'm not sure how you've set ngrok up, but that may be the issue. Everytime you restart ngrok you get a new subdomain, so you may need to update your URL on your Twilio number.
In the case of not seeing the XML in the browser, it's because the quickstart doesn't set the right content type. You can fix that, in Sinatra, by setting the content type, and you'd do so like this:
get '/hello-monkey' do
content_type "text/xml"
Twilio::TwiML::Response.new do |r|
r.Say 'Hello Monkey'
end.text
end
Let me know if this helps at all.

Twilio: statusCallBack?

Need some Twilio help. I am a novice and I'm kinda lost. This may seem overly simplistic BUT I have a CRM client that will track calls as long as the inbound calls ping the URL - x2vps.com/index.php/api/voip/data/{caller id goes here}
Note: The CRM will automatically track all registered phone numbers that ping this URL.
I have the call routing piece figured out. I can't figure out how to code twilio's API to append the inbound caller ID's to the CRM's URL and ping it. I want to log all calls regardless of the status.
If you could point me in the right direction I would be truly appreciative.
Thank you!
Twilio developer evangelist here.
Twilio does not append the caller ID to the webhook URL that you set. In order to do something like this, you'd need to provide some sort of server in the middle that can transform the Twilio request into the format you need.
You'd do this by creating a web application that would be able to receive the webhook from Twilio. It would then need to get the incoming Caller ID from the Twilio request, this is the From parameter. With the Caller ID, your application would then construct your CRM endpoint URL and make the HTTP request itself. You'd need to decide whether you need to include all the original parameters, if the CRM system can use them.
Let me know if this helps.

IRC /TOPIC command trimming issue in iOS

I am using Cocoa async socket library in my iOS application to make connection with an IRC server via Tcp sockets. All the IRC commands are working perfectly except /TOPIC command.
When I send a topic command it always trim the first two characters in the response. Please check the example wireshark report below.
It works on other IRC clients (mIRC). How can I identify the root cause of the issue?
If you send your own IRC commands (most IRC clients let you easily inject arbitrary commands with /command here), you have to format it correctly, with a : before the final parameter if it contains spaces:
TOPIC #abcdereh :My name is Clement
Most IRC clients have an alias for /TOPIC that does that stuff for you.
If you are writing your own client, make sure that you handle the following cases:
/TOPIC: send TOPIC #currentchannel
/TOPIC #somechannel send TOPIC #somechannel
/TOPIC Not a channel send TOPIC #currentchannel :Not a channel
/TOPIC #somechannel New Topic send TOPIC #somechannel :New Topic

Resources