cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
856
Views
0
Helpful
7
Replies

How to store data in variable and reference it

AshG
Level 4
Level 4

Hi Raghavendra,

We are using below command to get data from http server.

::httpios::geturl <url> -command getEndCallResponse -timeout


getEndCallResponse is another proc which retrieves the data. However we are not able to understand how to use the data returned.


we want to reference to that data ( Possibly by storing it in variable) and update the DNIS of Sip Header. Both Invite and To Filed.


Can you please help.


Thanks

Ashish

1 Accepted Solution

Accepted Solutions

You need to add "global resp" in your function as below.

proc getHTTPiosResponse {token} {

global resp

Thanks,

Raghavendra

View solution in original post

7 Replies 7

Raghavendra G V
Cisco Employee
Cisco Employee

Hi Ashish,

Please refer SIP Headers section in TCL ivr programming guide from below link.

https://developer.cisco.com/site/voice-gateway/documentation/

Thanks,
Raghavendra

Thanks Raghavendra,

Looking at the guide.

Another question . We are trying to not answer the call in tcl script but just use "leg proceeding leg_incoming"

Update the sip header with new DNIS and then release the call from .tcl script and let carry on its normal route. I.e hit the next dial peer in gateway.

is this do able ? and any pointers will help.

Thanks

Ashish

I  am not sure, But headers need to be passed to leg setup command.
set callinfo(protoHeaders) headers

Thanks,
Raghavendra

Hi Raghavendra,

We are not able to store data returned by http in variable to use it later.

we have tried to define global variables or even tried to use token but not able to refer to the data.

we can see the data in log but not sure how to refer to it.

Any idea?

Thanks

Ashish

I don't understand why you can't refer the data, could you share code how you are trying to refer the data.

Thanks,

Raghavendra

Hi Raghavendra,

Apologies for late reply. Due to some other work we had to drop this development for a while.

Below is my code.  However we have found that we need to use function

httpios:data to retrieve output from url ?

getHTTPiosResponse is proc we use in - command.

Thanks

Ashish

proc getHTTPiosResponse {token} {
# Get response data
puts "***** In getHTTPiosResponse: start"

# Declare variables
variable resp

if {![ string compare [ ::httpios::status $token ] "ok" ]} {
    puts "***** In getHTTPiosResponse: http status ok "
set resp [ httpios::data $token ]
puts "***** In getHTTPiosResponse: Response - $resp"
} else {
    puts stderr [ ::httpios::error $token ]
}
httpios::cleanup $token

You need to add "global resp" in your function as below.

proc getHTTPiosResponse {token} {

global resp

Thanks,

Raghavendra