Feedback

  • Contents
 

Get and Set attributes

The functions below demonstrate how to set and get call attributes from a call that is on the user's queue while logged into Scripter.  It also demonstrates how useful the IS_Action_Trace function is.

NOTE: These code snippets attributes only work in Scripter.Net.

/*
This method will return the value of a given call attribute
* @param p_sAttributeName
* @Author PureConnect Customer Care
*/
function getCallAttr(p_sAttributeName) {
    var CallObj = scripter.createCallObject();
    var attrValue = "";
    CallObj.id = IS_ATTR_Callid.value;
    if (CallObj.id != -1) {
        attrValue = CallObj.getAttribute(p_sAttributeName);
        IS_TraceNote('Callid: ' + CallObj.id + ' Getting Attr: ' + p_sAttributeName +
            "=" + attrValue);
        return attrValue;
    }
    else {
        IS_TraceError('Could not get valid call object');
        return attrValue;
    }
}
/*
This method will set the value of a given call attribute
* @param p_sAttributeName
* @param p_sAttributeValue
* @Author PureConnect Customer Care
*/
function setCallAttr(p_sAttributeName, p_sAttributeValue) {
    var CallObj = scripter.createCallObject();
    var attrValue = "";
    CallObj.id = IS_ATTR_Callid.value;
    if (CallObj.id != -1) {
        IS_TraceNote('Callid: ' + CallObj.id + ' Setting Attr: ' + p_sAttributeName + "=" + p_sAttributeValue);
        CallObj.setAttribute(p_sAttributeName, p_sAttributeValue);
    }
    else {
        IS_TraceError('Could not get valid call object');
    }
}
/*
 * This method will bring send custom trace messages to the Scripter vwrlog
 * @Author PureConnect Customer Care
*/ function IS_TraceNote(p_message) {     IS_Action_Trace.message = p_message;     IS_Action_Trace.level = 3; // 3= Notes level          IS_Action_Trace.click(); } function IS_TraceError(p_message) {     IS_Action_Trace.message = p_message;     IS_Action_Trace.level = 0; //0 = Error level          IS_Action_Trace.click(); }