Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


...



Html
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.11';
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

...

Html
<div class="fb-like" data-href="#https://confluence.wildix.com/x/AQOmB" data-layout="button_count" data-action="recommend" data-size="large" data-show-faces="true" data-share="true"></div>

...

Html
 <div class="lang-box-pdf">
	<div>
		<div class="google-lang-switch">
			<span<div classid="letters-form"><a title="English" href="#">EN</a>&nbsp;|&nbsp;<a title="Italian" href="#" >IT</a>&nbsp;|&nbsp;<a title="French" href="#" target="_blank">FR</a>&nbsp;|&nbsp;<a title="German" href="#">DE</a></span>
		</div>
		<div class="google-lang">
			<div id="google_translate_element">
			</div>
			<script type="text/javascript">
					function googleTranslateElementInit() {
						new googlegoogle_translate_element">
			</div>
			<script type="text/javascript">
					function googleTranslateElementInit() {
						new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'de,es,fr,it,nl', autoDisplay: false}, 'google_translate_element');
						}
			</script>
			<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
		</div>
		
		<div class="pdf-button">
			<a href="#" alt="https://confluence.wildix.com/spaces/flyingpdf/pdfpageexport.action?pageId=77988609" alt="Convert to .pdf" title="Convert to .pdf"><img src="https://confluence.wildix.com/download/attachments/14549012/pdf-button-download-wildix-documentation.png"></a>
		</div>
	</div>
</div>


Info

Document descriptionThe Articles describes how to use a new authentication method to make WMS API requests.

Created: September 2020

Permalinkhttps://confluence.wildix.com/x/AQOmB

Table of Contents

Introduction

On WMS 5, basic authentication (user/pass) for WMS API requests is disabled, which means that requests like the following one are no longer acceptable. 

...

However, to simplify your development, there is Wildix php library that you can use which handles all the process for authentication. Besides the mentioned php library, a tool for dependency management in php called composer will also be used here. Neither s2s-client-php nor composer are mandatory when trying to use Wildix API, but here they are used to show a basic working example. In a php environment they make it easier to consume Wildix APIs but any language/ environment that can implement JWT tokens can be used for your development.

Installation

1. A server with apache2 and php installed is assumed.  First, install required dependencies: 

...

Code Block
$dig +short repo.packagist.org
$echo '142.44.164.249 repo.packagist.org' >> /etc/hosts   


Consuming the Wildix API

First, you need to create an “Application ID” and a secret for your application. In WMS (logged in as admin) go to PBX -> Integrations-> Server to Server applications and click Add

...

Now create php scripts to consume the application.

CallQueues

This first example will consume API “Call Queues” (Get a list of call Queues): 

...

Note

Note: in the previous picture that the status code and headers responses were commented in order to be able to format the entire output as json, see next image.


When the script is run: 


CallHistory

For this example we will consume API “CallHistory” (Get a global call history): 

...

Note

Note: in the previous picture the status code and headers responses were commented in order to be able to format the entire output as json.  See the next image.


When the script is run: 


Sounds

For this example we will consume API “Sounds” (Create or update sound.):

...

When the script is run: 


And in WMS sounds: 


Originate

For this example we will consume API “Originate” (used to create new calls):

...

http(s)://<PBX>/api/v1/Originate

POST Parameters

Parameter

Example

Description

channel

Local/222@users

Channel that will be created as first leg of the call, in this case extension 222 will be called

context

users

If the first leg of the call (channel) is successfully created, in what Dialplan to create the second leg, in this case we use users (internal Dialplan that should allow dialing external numbers)

exten

16144841500

If the first leg of the call (channel) is successfully created, what number to call in the specified Dialplan (context), in this case the external number we want to dial

priority

1

Always use 1

callerid

\"Announcer\" <16144841500>

Callerid that will be shown on the first leg of the call, in this case as caller id name we use “Announcer” and as caller id number we use the number we will dial


1. Create a php file (in this case originate.php) in your project folder and add the following content: 

...

When the call is answered:


Html
<div class="fb-like" data-href="https://confluence.wildix.com/x/AQOmB" data-layout="button_count" data-action="recommend" data-size="large" data-show-faces="true" data-share="true"></div>