GetXpath

Description (v2.0.2)

INFO Get an XML page and set variables to corresponding Xpath values

Release notes

Version 2.0.2 - Deprecated
  • Bugfix: The timeout would sometimes not be taken into account (M9316)
  • Deprecated: Builtin separator variable is overwritten (M13234)

Version 2.0.1 - Deprecated
  • Improvement: Added ability to choose the separator for multiple output (default: '-')
  • Bugfix: Fixed timeout detection during http requests (default: 5s, max: 60s) (M0007524)
  • Improvement: Added 'accept-language' http header to the request (default: en)
  • Deprecated: Builtin separator variable is overwritten (M13234)

Version 1.4 - General deployment
  • Improvement: Compatibility with the Communication Server module
  • Dependency:
    • SOP API module branch 2 >= 2.30.0 or SOP API module branch 3 >= 3.1.0

Version 1.03 - General deployment
  • Feature: New behavior when multiple entries in result
  • Dependency:
    • SOP API module branch 2 >= 2.30.0 or SOP API module branch 3 >= 3.1.0

Version 1.02 - General deployment
  • Improvement: Remove unnecessary variable affectation
  • Feature: Implement configurable timeout (needs newer version of Asterisk module)

Version 1.01 - Deprecated
  • Deprecated: Significant improvements have been done in a higher version

Version 1.00 - General deployment
  • Initial version

Action Parameters

  • Url: URL of the Web Service. Don't forget to URL-encode reserved characters when applicable.
  • Variable 1: name of the global variable in which the 'Xpath 1' result will be stored
  • Xpath 1: path to 'Xpath 1' variable within your XML result
  • Variable 2: name of the global variable in which the 'Xpath 2' result will be stored
  • Xpath 2: path to 'Xpath 2' variable within your XML result
  • Variable 3: name of the global variable in which the 'Xpath 3' result will be stored
  • Xpath 3: path to 'Xpath 3' variable within your XML result
  • When multivalue result return XPath queries can return multiple values, this option allows you to choose how to present the data. If first is selected, only the first result of the set will be returned, if last is selected only the last result of the set will be returned, if all is selected, then all the values will be returned.
  • Variable name for RAW body: returns the full body of the page queried. It can be usefull to get documents that aren't formatted in XML.
  • Timeout: timeout used when making the Xpath request. The default is 5 seconds.
  • Separator: A string used to concatenate the results when multivalue result return is set to all. Default is a dash (-).

Return Values

  • GetXPathError: This variable is set by GetXPath to indicate whether the HTTP request succeeded.
Code Meaning
0 Success
1 Success, but response was empty
2 HTTP Error (404, 500, ...)

Example of use

GetXPath is a callflow action which allows you to send HTTP requests to any XML Web Service server and store the XML information results in a global variables for further use within the current or other callflows.

Remark: XPath is a standard. See the following link for more information: https://www.w3schools.com/xml/xpath_syntax.asp

Route incoming calls to the right helpdesk agent.

  • A user calls your helpdesk
  • An IVR system asks the user for his current ticket number, assuming that he previously received a ticket number from your Trouble Ticket system
  • This ticket number, for example 1006545, is stored in ${TicketNr}
  • The GetXPath action sends an HTTP request to your Trouble Ticket system:
    • set 'Url=http://tickets.mycompany.com/getticketinfo.jsp?ticketnr=${TicketNr}'
  • The Trouble Ticket server returns an XML reply

<TicketInfo>
  <Number>1006545</Number>
  <Agent>The Big Lebowski</Agent>
  <Extension>624</Extension>
  <State>Open</State>
</TicketInfo>

  • We extract the agent's extension from the reply and store it in variable AgentExt
    • set 'Xpath 1=//TicketInfo/Extension[1]'
    • set 'Variable 1=AgentExt'
  • From this point on, you can use ${AgentExt} anywhere in your callflow
Copyright © Escaux SA