Using IAXOCX in WEB browser

If you need the full demo codes ,please send email to support@ipxchina.cn.
You can get more information from our website http://www.ipxchina.cn.


The screen image of IAXOCX in browser.



iaxocxweb.jpg



These are some sample codes for using IAXOCX in Javascript.



<script language="javascript">
var is_initOk=false;
function Register(){
try
{
if (!is_initOk)
alert("Please init it!");
MVBPhone.HostName=HostName.value;
MVBPhone.Port=Port.value;
MVBPhone.UserID=UserID.value;
MVBPhone.Password=Password.value;
dispRegistration.value="Registering to:"+MVBPhone.hostName+"...";
MVBPhone.Register();

}
catch(e)
{
;
}
return;
}

function Init(){
try
{
var retvalue;
if (is_initOk)
{
alert("Already inited!");
return;
}
retvalue=MVBPhone.InitIax(1);
if (retvalue==0){
is_initOk=true;
AudioDevice();
alert("init ok!");
}
}
catch(e)
{
;
}
return;
}

function Dial(){
try
{
if (!is_initOk)
alert("Please init firstly!");
else
MVBPhone.Dial(dialnumber.value);
}
catch(e)
{
;
}
return;
}
function ShutDown(){
try
{
if (is_initOk)
MVBPhone.ShutDown();
is_initOk=false;
}
catch(e)
{
;
}
return;
}
function Hold(){
try
{
MVBPhone.Hold(0);
}
catch(e)
{
;
}
return;
}
function SendDTMF(dtmfchar){
try
{
MVBPhone.SendDTMF(dtmfchar);
}
catch(e)
{
;
}
return;
}
function UnHold(){
try
{
MVBPhone.UnHold(0);
}
catch(e)
{
;
}
return;
}
function Answer(){
try
{
MVBPhone.AcceptCall(0);
}
catch(e)
{
;
}
return;
}
function AudioDevice(){
try
{
if (!is_initOk)
alert("Please init it!");
else{
dispAudioDevices.value="";
MVBPhone.GetAudioDevice();
}
}
catch(e)
{
;
}
return;
}
function HangUp(){
try
{
MVBPhone.HangUp();
}
catch(e)
{
;
}
return;
}
function onLevels(InputLevel, OutputLevel){
try
{
dispLevels.value="INPUT:"+InputLevel/1000+"DB,OUTPUT:"+OutputLevel/1000+"DB";
}
catch(e)
{
;
}
return;
}
function onRegistration(RegID, Reply, msgCount, ReplyText){
try
{
dispRegistration.value="注册状态:"+ReplyText+",留言:"+msgCount+"\r\n";
}
catch(e)
{
;
}
return;
}
function onStateMessages(CallNo, State, Message){
try
{
dispStateMessages.value="线路:"+CallNo+",状态:"+Message+"\r\n"+dispStateMessages.value;
}
catch(e)
{
;
}
return;
}

function onStateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext){
try
{
dispStateEvents.value="线路:"+CallNo+",状态:"+State+",编码:"+AudioFormat+",来自:"+RemoteNumber+"\r\n"+dispStateEvents.value;
}
catch(e)
{
;
}
return;
}
function onAudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig){
try
{
dispAudioDevices.value=dispAudioDevices.value+"ID:"+DeviceID+",DeviceName:"+DeviceName+",DeviceType:"+DeviceType+",DeviceConfig:"+DeviceConfig+"\r\n";
}
catch(e)
{
;
}
return;
}
function MVBPhone_onkeypress() {
var key;
var keychar;
var reg;
if(window.event) {
// for IE, e.keyCode or window.event.keyCode can be used
key = event.keyCode;
}
else if(e.which) {
// netscape
key = event.which;
}
else {
// no event, so pass through
return true;
}

if (!is_initOk || MVBPhone.GetLineStateINT(0)<=0)
return;

keychar = String.fromCharCode(key);
if ((keychar>=0 && keychar<=9)
keychar=='*'
keychar=='#')
SendDTMF(keychar);
}
</script>
<script language="JavaScript" for="MVBPhone" event="Registration( RegID, Reply, msgCount, ReplyText)">
onRegistration(RegID, Reply, msgCount, ReplyText);
</script>
<script language="JavaScript" for="MVBPhone" event="StateMessages( CallNo, State, Message)">
onStateMessages(CallNo, State, Message);
</script>
<script language="JavaScript" for="MVBPhone" event="StateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext) ">
onStateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext);
</script>
<script language="JavaScript" for="MVBPhone" event="AudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig)">
onAudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig);
</script>
<script language="JavaScript" for="MVBPhone" event="Levels( InputLevel, OutputLevel)">
onLevels( InputLevel, OutputLevel);
</script>
If you need the full demo codes ,please send email to support@ipxchina.cn.
You can get more information from our website http://www.ipxchina.cn.


The screen image of IAXOCX in browser.



iaxocxweb.jpg



These are some sample codes for using IAXOCX in Javascript.



<script language="javascript">
var is_initOk=false;
function Register(){
try
{
if (!is_initOk)
alert("Please init it!");
MVBPhone.HostName=HostName.value;
MVBPhone.Port=Port.value;
MVBPhone.UserID=UserID.value;
MVBPhone.Password=Password.value;
dispRegistration.value="Registering to:"+MVBPhone.hostName+"...";
MVBPhone.Register();

}
catch(e)
{
;
}
return;
}

function Init(){
try
{
var retvalue;
if (is_initOk)
{
alert("Already inited!");
return;
}
retvalue=MVBPhone.InitIax(1);
if (retvalue==0){
is_initOk=true;
AudioDevice();
alert("init ok!");
}
}
catch(e)
{
;
}
return;
}

function Dial(){
try
{
if (!is_initOk)
alert("Please init firstly!");
else
MVBPhone.Dial(dialnumber.value);
}
catch(e)
{
;
}
return;
}
function ShutDown(){
try
{
if (is_initOk)
MVBPhone.ShutDown();
is_initOk=false;
}
catch(e)
{
;
}
return;
}
function Hold(){
try
{
MVBPhone.Hold(0);
}
catch(e)
{
;
}
return;
}
function SendDTMF(dtmfchar){
try
{
MVBPhone.SendDTMF(dtmfchar);
}
catch(e)
{
;
}
return;
}
function UnHold(){
try
{
MVBPhone.UnHold(0);
}
catch(e)
{
;
}
return;
}
function Answer(){
try
{
MVBPhone.AcceptCall(0);
}
catch(e)
{
;
}
return;
}
function AudioDevice(){
try
{
if (!is_initOk)
alert("Please init it!");
else{
dispAudioDevices.value="";
MVBPhone.GetAudioDevice();
}
}
catch(e)
{
;
}
return;
}
function HangUp(){
try
{
MVBPhone.HangUp();
}
catch(e)
{
;
}
return;
}
function onLevels(InputLevel, OutputLevel){
try
{
dispLevels.value="INPUT:"+InputLevel/1000+"DB,OUTPUT:"+OutputLevel/1000+"DB";
}
catch(e)
{
;
}
return;
}
function onRegistration(RegID, Reply, msgCount, ReplyText){
try
{
dispRegistration.value="注册状态:"+ReplyText+",留言:"+msgCount+"\r\n";
}
catch(e)
{
;
}
return;
}
function onStateMessages(CallNo, State, Message){
try
{
dispStateMessages.value="线路:"+CallNo+",状态:"+Message+"\r\n"+dispStateMessages.value;
}
catch(e)
{
;
}
return;
}

function onStateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext){
try
{
dispStateEvents.value="线路:"+CallNo+",状态:"+State+",编码:"+AudioFormat+",来自:"+RemoteNumber+"\r\n"+dispStateEvents.value;
}
catch(e)
{
;
}
return;
}
function onAudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig){
try
{
dispAudioDevices.value=dispAudioDevices.value+"ID:"+DeviceID+",DeviceName:"+DeviceName+",DeviceType:"+DeviceType+",DeviceConfig:"+DeviceConfig+"\r\n";
}
catch(e)
{
;
}
return;
}
function MVBPhone_onkeypress() {
var key;
var keychar;
var reg;
if(window.event) {
// for IE, e.keyCode or window.event.keyCode can be used
key = event.keyCode;
}
else if(e.which) {
// netscape
key = event.which;
}
else {
// no event, so pass through
return true;
}

if (!is_initOk || MVBPhone.GetLineStateINT(0)<=0)
return;

keychar = String.fromCharCode(key);
if ((keychar>=0 && keychar<=9)
keychar=='*'
keychar=='#')
SendDTMF(keychar);
}
</script>
<script language="JavaScript" for="MVBPhone" event="Registration( RegID, Reply, msgCount, ReplyText)">
onRegistration(RegID, Reply, msgCount, ReplyText);
</script>
<script language="JavaScript" for="MVBPhone" event="StateMessages( CallNo, State, Message)">
onStateMessages(CallNo, State, Message);
</script>
<script language="JavaScript" for="MVBPhone" event="StateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext) ">
onStateEvents( CallNo, State, AudioFormat, VideoFormat, RemoteNumber, RemoteName, LocalNumber, LocalContext);
</script>
<script language="JavaScript" for="MVBPhone" event="AudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig)">
onAudioDevices( DeviceID, DeviceName, DeviceType, DeviceConfig);
</script>
<script language="JavaScript" for="MVBPhone" event="Levels( InputLevel, OutputLevel)">
onLevels( InputLevel, OutputLevel);
</script>
Created by: jalonljc, Last modification: Wed 04 of Aug, 2010 (07:36 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+