Jump to content

Function: LaunchHTTPRequest


Tom Wellige

Recommended Posts

This post is taken from the Swyx Forum Archive (2007-2014) and was originally posted 27.04.2010 by me

 

 

EDIT 02.2021: beside the following function you might also want to take a look on the

-> PBXScript.WebRequest

which was added with SwyxWare 12.40

 

This function calls (launches) a given URL (http request) and returns True if the request returns without error.

 

 

Please find the LaunchHTTPRequest function in the Function Collection (VBScript) and Function Collection (Lua) area of the Programming References section of the SwyxPEDIA here on Swyx Forum. 

 

 

Link to comment
Share on other sites


  • 4 months later...

Hello Tom,

 

do i have to install anything on my Windows server to use this script?

do i have to install this for it to work (https://support.microsoft.com/en-us/help/290761/frequently-asked-questions-about-serverxmlhttp)?

Msxml2.ServerXMLHTTP.3.0

because this script wont work on my windows 12 server.

 

Best regards Jakob H

Link to comment
Share on other sites


  • 3 weeks later...

Hey Tom,

 

i found the error:

On 9/3/2019 at 9:51 PM, Tom Wellige said:

( sURL = '" sURL & "' )"

i had to change this to:

( sURL = "+ sURL & +" )"

Then i used your code to make an HTTP request to my own C# API to get the number from the on-call duty person with "HTTP_REQ.responseText".

 

Thank you for your awesome work in this forum!

 

With best regards Jakob H

Link to comment
Share on other sites


  • 1 month later...

 

Hi there, I would like to call a URL for incoming calls, which should then save the number in a variable. I used your script for this. The number also arrives, but with +49 I would like 0049 instead of +49 is that possible?

Link to comment
Share on other sites


14 minutes ago, Daniel A said:

Hi there, I would like to call a URL for incoming calls, which should then save the number in a variable. I used your script for this. The number also arrives, but with +49 I would like 0049 instead of +49 is that possible?

 

What Client SDK API or SwyxIt! Variable are you using the get the caller number?

 

Link to comment
Share on other sites


Hi,

 

the function IpPbx.CallingNumber calls PBXCall.CallingPartyNumber which actually should return the caller number not in canonical (+49) but in the wanted format (0049).

 

The only reason I can think of at the moment, that you are getting the number in canonical format, is that you have the caller in the global/private phone book which sets the number internally then in canonical format.

 

Do you have the caller in your global/private phone book?

 

Link to comment
Share on other sites


1 hour ago, Tom Wellige said:

Hallo,

 

Die Funktion  IpPbx.CallingNumber ruft PBXCall.CallingPartyNumber auf, die die  Anrufernummer eigentlich nicht kanonisch (+49), sondern im gewünschten Format (0049) zurückgeben soll.

 

Der einzige Grund, an den ich im Moment denken kann, dass Sie die Nummer im kanonischen Format erhalten, ist, dass Sie den Anrufer im globalen / privaten Telefonbuch haben, das die Nummer intern und dann im kanonischen Format festlegt.

 

Haben Sie den Anrufer in Ihrem globalen / privaten Telefonbuch?

 

hello, I've tried it again. It always comes with +49 instead of 0049. No is not in the phone book. Is there no way to replace the variable beforehand? Sincerely, Daniel
Link to comment
Share on other sites


I little bit of VBScript code should do the trick:

 

Dim sCaller
sCaller = IpPbx.CallingNumber

If Left(sCaller, 1) = "+" Then
	sCaller = "00" & Right(sCaller, Len(sCaller)-1)
End If

or

Dim sCaller
sCaller = Replace(IpPbx.CallingNumber, "+", "00")

 

Afterwards you use "sCaller" in your URL instead of "IpPbx.CallingNumber".

 

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.