Creating Answering Rule for Forward Always Using Curl

100 views
Skip to first unread message

Megan McKenna

unread,
Nov 7, 2013, 10:01:56 AM11/7/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
The script is:
 
curl -X POST -k "http://208.78.197.89/ns-api/" -H "Authorization: Bearer da88dc051c92fe9f13356846d214420b" -dobject=answerrule -daction=create -ddomain="SkyhighRolla" -duser=951 -dtime_frame=Week -dfor_control=e -dfor_parameters=17793797407 -dsim_control=d -dfnr_control=d -dfna_control=d -dorder=0
 
This seems to work as it changes the rules in the portal (screenshot included), however, when we run a test the call is not forwarded. The error in the trace is:
responder CNmsUaSessionStateInviteDevice::OnEntry fail to setup ForwardLeg. 2013-11-07 08:29:19 182243640
responder

CNmsUaSessionStateInviting::OnEntry can not send forward Invite.

 

 

 

 
If I add the rule from the admin portal is works fine. Can you please advise what step we may have missed or how we can get this working?
Thanks in advance for your response,
 
-Rohit, please feel free to chime at anytime. Rohit is the programmer and may be better able to answer any direct questions in that regard.
 
951_Forward.PNG

Eric Hernaez

unread,
Nov 7, 2013, 10:09:32 AM11/7/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Megan,

Can you please provide ?a call trace for a successful call when you create the rule from the admin portal?


~Eric

Chris Aaker

unread,
Nov 7, 2013, 10:50:00 AM11/7/13
to Eric Hernaez, netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
The issue is you have no timeframe called "Week". This rule is likely going to be ok if there was a timeframe that matched and it was in a valid window. If you do not wish to use a timeframe you can set it with "*" and that will show in the portal as "Default"

Chris


--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

Chris Aaker

NetSapiens Inc.
920 Kline St. #400, La Jolla, CA 92037
Phone: +1 (866) 4-VOIP-IQ x5226 Direct: +1 (858) 764-5226
Email: caa...@netsapiens.com gChat- c.a...@gmail.com

Megan McKenna

unread,
Nov 7, 2013, 11:10:17 AM11/7/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Chris before I saw your reply I was thinking the same thing. I have already sent the set of instructions to the programmer to achieve this, glad you confirmed the same thing. I appreciate the quick response.

Megan McKenna

unread,
Nov 8, 2013, 4:21:05 PM11/8/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Timeframes are not being added. We are trying to implement a forward always. Script is below.
 
.curl -X POST -k "http://208.78.197.89/ns-api/" -H "Authorization: Bearer 66bb96696576f8e94da4994d047aed24" -dobject=time_frame -daction=create -ddomain="SkyhighRolla" -downer_domain=955 -dtime_frame=Always -dorder=0 -ddate_from=now -ddate_to=never -ddays=0123456 -dtod_from=00:00 -dtod_to=23:59
 
 
 
Can you please provide assistance on why this might not be working? No errors are being returned, it is not just working through the API portal.
 

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:
955.PNG
955-Forward Rule.PNG
955-Forward Rule_Admin.PNG

Chris Aaker

unread,
Nov 8, 2013, 4:29:41 PM11/8/13
to Megan McKenna, netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
The object's name is "timeframe" not "time_frame". The doc provided is correct. 

Also when reporting a error using a curl example, please add -v and give that response as it will give a verbose output and in this case suggests the correction when i ran this command adding -v. 

Chris


--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Megan McKenna

unread,
Nov 11, 2013, 10:27:01 AM11/11/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Chris,
 
I also had Rohit try the command on our test box to see if there was an issue with code (since we are running 12.20 on our prod server). The results were still the same, no timeframe was created.
 
Script:
curl -X POST -k "http://208.86.220.15/ns-api/" -H "Authorization: Bearer 1d0cda142465868f9ad90129b8e80d8a" -dobject=timeframe -daction=create -ddomain="SkyhighRolla" -downer_domain=963 -dtime_frame=Always -dorder=0 -ddate_from=now -ddate_to=never -ddays=0123456 -dtod_from=00:00 -dtod_to=23:59
 
 
Per Rohit, he is not sure how or where to run -v that you indicated in the last reply and requires additional instruction on that in order to produce the requested information.
I was hoping that we might be able to schedule a call with all of us to get this working? Are you available now?

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Megan McKenna

unread,
Nov 11, 2013, 10:30:09 AM11/11/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Actually, if we could get something scheduled for tomorrow that would be great, give you time to accept the meeting since I know you are not in the office yet...
Let me know if tomorrow would work for you.
 
7am PST/9am CDT/8:30PM India
 
However, if you have additional instruction Rohit is included on this email and may be able to try your recommendation prior to the meeting.
Thanks for your assistance on this,
 

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Chris Aaker

unread,
Nov 11, 2013, 10:44:23 AM11/11/13
to Megan McKenna, netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
With the -v i just mean turning on the verbose setting for curl. It gives much more detail on the error. also days you probably want to make * instead of all the days listed. Lets start with the error then we can schedule a time if needed. 

curl -X POST -k "http://208.78.197.89/ns-api/" -H "Authorization: Bearer 4c5cdb9feac14dd4117159bd7ae903b3" -dobject=timeframe -daction=create -ddomain="SkyhighRolla" -downer_domain=955 -dtime_frame=Always -dorder=0 -ddate_from=now -ddate_to=never -ddays=0123456 -dtod_from=00:00 -dtod_to=23:59 -v 


--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Megan McKenna

unread,
Nov 11, 2013, 10:50:10 AM11/11/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
I just want to document additional steps we tried to get this working.
 
Test User: 963 on Sandbox
-changed scope from basic user to office manager - timeframe still not listed
-changed scope from back to basic user and then added the default rules to user - timeframe still not listed
-changed scope from basic user to office manager with the default rules listed on the user - timeframe still not listed
 
I am not sure what else I can do to test. Also since there are no errors (that I have seen) being returned, I am not sure how to correct.
Thanks again for your help.
 
 

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Chris Aaker

unread,
Nov 11, 2013, 10:56:50 AM11/11/13
to Megan McKenna, netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
You need to add the "-v" in order to see what errors you are getting. changing the scope will not effect it after the fact. 

Chris


--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Megan McKenna

unread,
Nov 12, 2013, 9:12:22 AM11/12/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
I didn't see the programmers response, so I am posting it:
 
Hello Chris,



First I run this command to get the token which is valid for 3600 sec only :


curl -k -X POST "http://208.86.220.15/ns-api/oauth2/token/" -dclient_id='SkyhighRolla' -dclient_secret=9689714f00a961e3fa43ad80c22f4fe3 -dgrant_type=password -dusername=domain@SkyhighRolla -dpassword=9865472


  config.endpoint = "http://208.86.220.15/"
  config.client_id = 'SkyhighRolla'
  config.client_secret = '9689714f00a961e3fa43ad80c22f4fe3'
  config.username = 'domain@SkyhighRolla'
  config.password = '9865472'


Response :


{"access_token":"9f59b568678f90cd8c3d4e70f3fc1196","expires_in":3600,"scope":"Office Manager","refresh_token":"4cfb7f5c33c5198d495544b8b38e1ebf"}




Then I use this command for creating timeframe of user 963 :

curl -X POST -k "http://208.86.220.15/ns-api/" -H "Authorization: Bearer 9f59b568678f90cd8c3d4e70f3fc1196" -dobject=timeframe -daction=create -ddomain="SkyhighRolla" -downer_domain=963 -dtime_frame=Always -dorder=0 -ddate_from=now -ddate_to=never -ddays=0123456 -dtod_from=00:00 -dtod_to=23:59 -v



Response :



* About to connect() to 208.86.220.15 port 80 (#0)
*   Trying 208.86.220.15... connected
* Connected to 208.86.220.15 (208.86.220.15) port 80 (#0)
> POST /ns-api/ HTTP/1.1
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 208.86.220.15
> Accept: */*
> Authorization: Bearer 9f59b568678f90cd8c3d4e70f3fc1196

> Content-Length: 162
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 Bad Request
< Date: Tue, 12 Nov 2013 04:02:08 GMT

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Megan McKenna

unread,
Nov 12, 2013, 10:02:16 AM11/12/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Error Log from Admin UI:
Time Client ID Controller Action Error
2013-11-12 14:54:11 SkyhighRolla Timeframes checkScope aco.action='create' aco.model='timeframe' aco.uid='*' aco.domain='*' aro.uid='domain@SkyhighRolla' aro.domain='SkyhighRolla' aro.territory='Invision' scope='Reseller' is FALSE
 
Programmers Script with -v:
[8:54:32 AM] Circar Consulting: rohit@rohit-desktop:~/Rails_Apps/affairfinder$ curl -X POST -k "http://208.78.197.89/ns-api/" -H "Authorization: Bearer 4448034909329668a57825e57161bdc2" -dobject=timeframe -daction=create -downer_domain=SkyhighRolla -dname="Always" -downer=972 -v
* About to connect() to 208.78.197.89 port 80 (#0)
*   Trying 208.78.197.89... connected
* Connected to 208.78.197.89 (208.78.197.89) port 80 (#0)

> POST /ns-api/ HTTP/1.1
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 208.78.197.89
> Accept: */*
> Authorization: Bearer 4448034909329668a57825e57161bdc2
> Content-Length: 78
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 401 Unauthorized
< Date: Tue, 12 Nov 2013 14:54:11 GMT
< Server: Apache/2.2.15 (Fedora)
< X-Powered-By: NetSapiens
< Access-Control-Allow-Origin: *
< Warning: Invalid Scope
< Content-Length: 0
< Connection: close
< Content-Type: text/html; charset=UTF-8
< X-Pad: avoid browser bug
<
* Closing connection #0
 
How do we correct that error?

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Megan McKenna

unread,
Nov 12, 2013, 10:23:01 AM11/12/13
to netsapiens-de...@googlegroups.com, ro...@circarconsulting.com
Chris,
 
Are you able to help us out with this? The errors we are getting is for invalid scope, I have tried changing the scope on both the domain and individual user that we are trying to add the timeframe to but that has not helped.
They need this task completed today can we get on a call?

On Thursday, November 7, 2013 9:01:56 AM UTC-6, Megan McKenna wrote:

Chris Aaker

unread,
Nov 12, 2013, 10:45:08 AM11/12/13
to Megan McKenna, netsapiens-de...@googlegroups.com, Rohit K
Megan, 

I will contact you off this thread. This is a public forum so i do not want to keep everyone on this thread. 

Chris


--
You received this message because you are subscribed to the Google Groups "NetSapiens Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netsapiens-develope...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages