skrusty / AsterNET.ARI

AsterNET.ARI is an incubation project and addition to the AsterNET framework for .NET. It allows you to develop against Stasis ARI for Asterisk using the .NET framework.
http://www.xdev.net/projects/asternet-ari/
MIT License
87 stars 51 forks source link

Not work send variables in Channels.Originate in Asterisk 13.8.2 (may be all 13.x) #27

Closed eig980 closed 8 years ago

eig980 commented 8 years ago

In Asterisk 13.8.2 for create new channel variables send in BODY (not in URI) in JSON-format.

With using http://ari.asterisk.org/ - i set variables: {"variables":{"myvar":"zxcvzxcvxcv"}} and all work fine;

But with code: var per = new Dictionary<string, string>(); per.Add("myvar", "123456789");

Client.ClientIVR.Channels.Originate("Local/999@DialExtension", "s", "DialExtension", 1, variables: per, originator: e.Channel.Id);

Asterisk create channel BUT - without channels variables ((

skrusty commented 8 years ago

What version of AsterNET.ARI are you using? Nuget or source?

skrusty commented 8 years ago

Sounds like issue #26 This is working in current version (i use it for setting sip headers every day!)

eig980 commented 8 years ago

Last version 1.1 (reinstalled 5 minutes ago ))) from Nuget (PM> Install-Package AsterNET.ARI in Visual Studio). I try make debug info, but it takes time

skrusty commented 8 years ago

Thanks, if possible a wireshark/http capture or something of the actual POST would be good! It should highlight any issues right away.

eig980 commented 8 years ago

it's possible if you make DETAILED instruction how i can make it debug ((( I can not found how debug POST from your code to asterisk (((

eig980 commented 8 years ago

May be help tcpdump (variables - firstVar and secondVar)

from ari.asterisk.org i send {"variables":{"myvar":"zxcvzxcvxcv"}}, but in tcpdump i see only {"firstVar":"asdf","secondVar":"123456789"}!!!! Where{"variables":xxxxxx} ???

DUMP: 21:37:53.333058 IP 95.163.76.133.56015 > pbx.corp.amiteg.ru.radan-http: Flags [P.], seq 18303:18728, ack 19784, win 507, length 425 E...j@.}....L..|'.......K}FO.P.......POST /ARI/channels?endpoint=Local%2F999%40DialExtension&extension=s&context=DialExtension&priority=1&originator=1462905463.5 HTTP/1.1 Authorization: Basic YW1pc3Ryb3k6Y2VsZXJvbjEyMw== Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml User-Agent: RestSharp/104.4.0.0 Content-Type: application/json Host: pbx.amiteg.ru:8088 Content-Length: 43 Accept-Encoding: gzip, deflate

21:37:53.372930 IP pbx.corp.amiteg.ru.radan-http > 95.163.76.133.56015: Flags [.], ack 18728, win 731, length 0 ...(.(@.@....|'.L.....}FO.....P.... 21:37:53.376270 IP 95.163.76.133.56015 > pbx.corp.amiteg.ru.radan-http: Flags [P.], seq 18728:18771, ack 19784, win 507, length 43 E..S`k@.}..G.L..|'........}FO.P...#...{"firstVar":"asdf","secondVar":"123456789"} 21:37:53.376302 IP pbx.corp.amiteg.ru.radan-http > 95.163.76.133.56015: Flags [.], ack 18771, win 731, length 0 ...(.)@.@....|'.L.....}FO.....P.... 21:37:53.377309 IP pbx.corp.amiteg.ru.radan-http > 95.163.76.133.56015: Flags [P.], seq 19784:19953, ack 18771, win 731, length 169 E....*@.@.. .|'.L.....}FO.....P.......HTTP/1.1 200 OK Server: Asterisk/13.8.2 Date: Tue, 10 May 2016 18:37:53 GMT Cache-Control: no-cache, no-store Content-type: application/json Content-Length: 396

21:37:53.377335 IP pbx.corp.amiteg.ru.radan-http > 95.163.76.133.56015: Flags [P.], seq 19953:20349, ack 18771, win 731, length 396 E....+@.@..&.|'.L.....}FP.....P.......{ "id": "1462905473.6", "name": "Local/999@DialExtension-00000001;1", "state": "Down", "caller": { "name": "", "number": "" }, "connected": { "name": "0101113", "number": "0101113" }, "accountcode": "", "dialplan": { "context": "DialExtension", "exten": "999", "priority": 1 }, "creationtime": "2016-05-10T21:37:53.376+0300", "language": "ru" } `

skrusty commented 8 years ago

hmm! I need to review the RestSharp docs. Not sure why it's not rendering the json array to an object named variables.

eig980 commented 8 years ago

I see, that in issue #26 fixed problem with using "var SetValuesDict = new Dictionary<string, object> { { "variables", value } };...........". As result we have in POST "{"variables":value}" and all work (theoretically, not tested). May be you use it solution or variants?

eig980 commented 8 years ago

Tell me, please , when the error will be corrected ? Very-very-very-very need ((( Thanks

claudiuolteanu commented 8 years ago

Hello folks,

I believe that there is a problem with binaries/sources from AsterNET.ARI 1.1.0 version. After commit a3f77e9fe20a6 (which is labeled with AsterNET.ARI 1.1.0) the ARI models should be regenerated using the new template.

Claudiu

claudiuolteanu commented 8 years ago

@eig980 you can solve your problem following these steps:

skrusty commented 8 years ago

@claudiuolteanu Thanks for the input.

We need a better build process that includes generating the models beforehand! It's something I would like to address in the near future, just hard to find the time.