Jump to content

hsidhu

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by hsidhu

  1. Hello ,

     

    I am using rest api to create auto attendants account on pbx by using this method ` $vodiaObj->createAccount("localhost", array("account" => "66666", "type" => "attendants"));`

    It creates the account no problem.

     

    But when I try to change the name(display) for the account it changes the value for both primary_name and display field.

    via using this method

     

    `$vodiaObj->putUserSettings("localhost", "66666", array("display" => "Day IVR"));`

     

    And When I pull settings via Rest api

    `

     

    {"acdani":"","ani":"","cdr_time":"","credit":"","dial_plan":"","dialog_state":"","dialog_subscribe":"","dialog_version":"","disabled":"","email_cdr":"","epid":"","location":"","max_call_duration":"","max_cdrs":"","need_license":"","param1":"","param2":"","param3":"","rb":"","rf":"","view_settings":"","visible":"","action":"","admin":"*","answer_wait":"","code_0":"","code_1":"","code_2":"","code_3":"","code_4":"","code_5":"","code_6":"","code_7":"","code_8":"*976662","code_9":"*976666","completion":"match","def_file":"","def_gap":"","display":"Day IVR","excluded":"","first_lang":"","flag":"","gap_0":"0","gap_1":"0","gap_2":"0","gap_3":"0","gap_4":"0","gap_5":"0","gap_6":"0","gap_7":"0","gap_8":"0","gap_9":"2","hangup":"","input_0":"","input_1":"","input_2":"","input_3":"","input_4":"","input_5":"","input_6":"","input_7":"","input_8":"334#","input_9":"333#","limited":"","min_digits":"1","moh":"","name_confirm":"false","name_trigger":"","night":"","operator":"","parameter":"","play_def":"false","prompt_0":"0","prompt_1":"0","prompt_2":"0","prompt_3":"0","prompt_4":"0","prompt_5":"0","prompt_6":"0","prompt_7":"0","prompt_8":"0","prompt_9":"0","record_code":"","record_ext":"","sd":"false","se":"false","second_lang":"","sl":"false","special_key":"true","timeout":"","verify":"true","wavfile":"","wc1":"555","wc2":"555","wc3":"555","wc4":"555","wc5":"555","welcome_loop":"","wf1":"recordings/att1_14.wav","wf2":"","wf3":"","wf4":"","wf5":"","comment":"","display":"Day IVR","name":"66666","text":"","wav":""}

    `

     

    I see that it has two 'display' keys in json

     

    Can you please tell me which key value pair should I send that only display name change.

     

    Thanks in advance

  2. Hello, I am working with these two rest commands

     

    Get CDR count:

    {"action":"count-cdr-summary","start":0,"length":1000,"domain":true}

    And

    Get CDR records:

    {"action":"load-cdr-summary","start":0,"length":50,"domain":true,"user":"false","missed":"false"}

    Here is the process i am using. I am logged in as extension user and than using session token with required (with POST method).

    But it returned me error - File json not found. Please ask your system administrator to check the log file.

    Thanks

  3. Thanks

     

    That's exactly I was going for after server to server websocket client solution. I uploaded those files Here.

     

     

    But one another thing I am wonder would make things easy if I could get status of all extension status at domain level.

     

    Now, I have to login into ext account to find the status and it only give user-state for the account which I am logging as. Its will be great I could get status of all extension in one output.

    {"action":"user-state","type":"extensions","account":"101", "code":"ringback", "chatstatus":"online"}
    

    Best Regards

  4. Not sure if it possible to set header parameters in websocket call according :

    Authorization and websockets headers

     

    If we could figure out http login with ajax (from different origin) or work around CORS could help.

     

    Like I am trying to do in this post : javascript Rest api

     

    This will be possible if you guys can all API access list in 'Access-Control-Allow-Origin: IP' in header

    Example from Here

     

     

     

    Then it will be alot easy to setup websocket connection by first making the HTTP request and websocket Handshake.

  5. Hello,

    I tried the same thing by opening up websocket connection with javascript.

    The problem is when websocket handshake with PBX, PBX requested session token but you can't set header in websockets.

     

    To test it try this: (just to test)

    Login into PBX as admin in one tab and then open another tab with your javascript websocket code. Make call after that you should get messages from PBX server in Chrome frames.

     

    But there is one more solution and that is make http call to get session token like this (but doesn't work). Than open websocket and it should have session token.

  6. Hello Everyone,

     

    I am trying to make javascript ajax call to rest api of voida api e.g /rest/session but getting cors error.

    I tried different solutions but didn't worked. I am using following code.

    var vars = { "name": "auth", "value": "admin " + CryptoJS.MD5('password') };
    $.ajax({
        type: "PUT",
        url: 'http://[pbx]/rest/system/session',
        headers:{
            "Access-Control-Allow-Origin": "*",
            'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With, Origin, Accept',
            'Access-Control-Allow-Methods': 'HEAD, GET, POST, PUT, DELETE, OPTIONS',
            },
        dataType: 'json',
        async: true,
        data: JSON.stringify(vars),
        success: function(data){
                console.log(data);
            },
        error: function(data){
            console.log(data);
            }
    });

    I am getting following errors

    OPTIONS http://[pbx]/rest/system/session
    send @ jquery.js:8630jQuery.extend.ajax
    @ jquery.js:8166loadView
    @ status.js:396(anonymous function)
    
    XMLHttpRequest cannot load http://[pbx]/rest/system/session. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://[HOST]' is therefore not allowed access. The response had HTTP status code 403.

    I also listed ip under access IP control

    IF you guys can look into it will solve another problems for me.

  7. Hello Everyone,

     

    I am trying to make javascript ajax call to rest api of voida api e.g /rest/session but getting cors error.

    I tried different solutions but didn't worked. I am using following code.

    var vars = { "name": "auth", "value": "admin " +  CryptoJS.MD5('password') };
    $.ajax({
    	type: "PUT",
    	url: 'http://[pbx]/rest/system/session',
    	headers:{
    		"Access-Control-Allow-Origin": "*",
    		'Access-Control-Allow-Headers': 'Content-Type, X-Requested-With, Origin, Accept',
    		'Access-Control-Allow-Methods': 'HEAD, GET, POST, PUT, DELETE, OPTIONS',
    		},
    	dataType: 'json',
    	async: true,
    	data: JSON.stringify(vars),
    	success: function(data){
    			console.log(data);
    		},
    	error: function(data){
    		console.log(data);
    		}
    });
    

    I am getting following errors

    OPTIONS http://[pbx]/rest/system/session
    send @ jquery.js:8630jQuery.extend.ajax 
    @ jquery.js:8166loadView 
    @ status.js:396(anonymous function) 
    
    XMLHttpRequest cannot load http://[pbx]/rest/system/session. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://[HOST]' is therefore not allowed access. The response had HTTP status code 403.

    IF you guys can look into it will solve another problems for me.

×
×
  • Create New...