This is a demonstration to use the same webphone instance on multiple pages.
For example you can begin a call on page A, launch a new page (page B started from page A), see the webphone status also on page B, then hangup the call either for page A or page B
It is not limited to only 2 pages. You can launch as many pages as you wish and the same webphone instance will be shared across all pages.
Here we are just using the getEvents(callback) webphone api to display the webphone state on our "events" div, however you can implement any other functionality in the same way using the other callbacks.
For the sake of simplicity we are using the same html file also for second pages here (multipage_example.html), but you can use also different pages, just make sure to add the below multipage handling in all your pages.
For this example to work, you need to:
make sure that you are running this html from your webphone directory (copy this file to your webphone folder)
set the serveraddress/username/password parameters to a valid value (in the webphone_api.js or add code to set these dynamically with setparameter())
set the autostart parameter to false (in the webphone_api.js or add code to set these dynamically with setparameter())
rewrite the 'testivr' callto number in this html (In this example the called numbers is is hardcoded to "testivr3", so you need to rewrite this below to a valid number to call via your SIP server or pass a valid number from your form or via API)
You can open any number of windows/tabs and push the Call and Hangup buttons on any page (you can add more functionality in the same way as these are implemented in this example)
Note: the webphone will be closed if you close the "main" page (from where it was started the first time), but if needed, it will auto start again on new pages.