Rate URL

The OEM Configure Options form presents to providers the abilty to provide a Rate URL.

The Rate URL is used by Zoiper to retrieve the price per minute for calls with the provider to a particular destination.

The "Rate URL" field in the Configure Options form needs to look similar to the following examples:

http://example.com/script.php?destination=${DESTINATION}&currency=${CURRENCY}&username=${USERNAME}&password=${PASSWORD}
http://example.com/get_rate.php?d=${DESTINATION}&c=${CURRENCY}&u=${USERNAME}&p=${PASSWORD}
http://example.com/rate/${DESTINATION}/${CURRENCY}/${USERNAME}/${PASSWORD}

The URL contains the following placeholders:
${DESTINATION}
${CURRENCY}
${USERNAME}
${PASSWORD}

${DESTINATION} is required.
${CURRENCY}, ${USERNAME} and ${PASSWORD} are optional

All placeholders need to be in capital letters.

The following are NOT valid placeholders:
${Destination}
${currency}
${Username}
${passWord}

The Rate URL is used by Zoiper as described below.

Zoiper will replace the placeholders ${DESTINATION}, ${CURRENCY}, ${USERNAME} and ${PASSWORD} and send an HTTP request to the resulting url.

The ${USERNAME} and ${PASSWORD} will be populated from the SIP account's credentials.

For example:
http://example.com/get_rate.php?d=${DESTINATION}&c=${CURRENCY}

will become:
http://example.com/get_rate.php?d=1553366&c=EUR

The response should be valid XML and should be formatted as the following example:

<?xml version="1.0" encoding="UTF-8"?> <rate> <currency>EUR</currency> <price>0.50</price> </rate>

The root XML tag of the response is:
<rate>

The tags should contain values in the following formats.

<currency> should contain a currency code, present in the "ISO 4217" standard.
"ISO 4217" standard reference links:
http://en.wikipedia.org/wiki/ISO_4217
http://www.iso.org/iso/home/standards/currency_codes.htm
http://www.currency-iso.org/dam/downloads/dl_iso_table_a1.xml

<price> should contain a floating point value. This is the price PER MINUTE.

The provider script may also return XML, stating an error has occurred.

NOTE: For the time being the error will not be shown to the user.

In the case of an error the XML should be formatted in the following fashion:

<?xml version="1.0" encoding="UTF-8"?> <error> <message>human friendly error message</message> <code>404</code> </error>

The root XML tag in case of an error is:
<error>

The tags contained in <error> are :
<message> - contains a human friendly (plain text) error message
<code> - contains an error code

A test/example Rate URL is:
https://oem.zoiper.com/test/rate1.php?d=${DESTINATION}&c=${CURRENCY}

Available destinations are:
789
123

Available currencies are:
EUR
BGN
USD

Requesting
https://oem.zoiper.com/test/rate1.php?d=123&c=BGN

results in

<?xml version="1.0" encoding="UTF-8"?> <rate> <currency>BGN</currency> <price>0.8</price> </rate>