C# Code for VoiceScriptCreateRequest

Hi,

I have created object of VoiceScriptCreateRequest with all data.

I dont know how to send it to the pgi to create this VoiceScript Template.

Any one please help us


Regards
Sara

Comments

  • Sara

    All you need to do if everything is in place is the Submit.

                try
                {
                    VoiceScriptCreate_Result = PC.VoiceScriptCreate(VoiceScriptCreate_Request);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(ex.Message);
                    System.Console.Read();
                    return;
                }

    The VoiceScriptCreate_Request is the object you have put together.

    If you provide your code I will take a look at it.

     

    Tom

  • Hi Tom,

    Thanks for your reply.

    I put my code here please check it

    void CreateVoiceScript()
    {
    PGIVoiceCreate.VoiceScriptCreateRequest vsc = new PGICallPreparation.PGIVoiceCreate.VoiceScriptCreateRequest();
    vsc.SubmitId = "99";
    vsc.ObjectStore = "ACSTesting";
    vsc.ReplaceExisting = true;

    PGIVoiceCreate.StoredObjectIdType so = new PGICallPreparation.PGIVoiceCreate.StoredObjectIdType();
    so.objKind = "vscript";
    so.ownership = PGICallPreparation.PGIVoiceCreate.StoredObjectLevelType.customer;
    so.groupName = "Wellient";
    so.groupNo = 1;
    so.groupNoSpecified = true;
    so.b64charset = "unspec";
    vsc.VoiceScriptId = so;

    PGIVoiceCreate.TransactionInfoType trans = new PGICallPreparation.PGIVoiceCreate.TransactionInfoType();
    PGIVoiceCreate.TransactionInfoTypeTransaction[] MyTrans = new PGICallPreparation.PGIVoiceCreate.TransactionInfoTypeTransaction[1];
    MyTrans[0] = new PGICallPreparation.PGIVoiceCreate.TransactionInfoTypeTransaction();
    MyTrans[0].transactionID = uint.Parse("99");
    MyTrans[0].TransactionName = "MyTrans1";
    MyTrans[0].transactionIDSpecified = true;

    PGIVoiceCreate.ExactMatchInfoType[] exact = new PGICallPreparation.PGIVoiceCreate.ExactMatchInfoType[1];
    exact[0] = new PGICallPreparation.PGIVoiceCreate.ExactMatchInfoType();
    PGIVoiceCreate.ExactMatchInfoTypeResponseRange eRes = new PGICallPreparation.PGIVoiceCreate.ExactMatchInfoTypeResponseRange();
    eRes.InsertId = uint.Parse("123");
    eRes.NumOfAttempts = uint.Parse("2");
    exact[0].ResponseRange = eRes;

    //PromptAttachement
    PGIVoiceCreate.DocumentInfoType doc = new PGICallPreparation.PGIVoiceCreate.DocumentInfoType();
    doc.DocType = "WAV";
    // Setup Document - TTS Template to be used
    PGIVoiceCreate.SosObjectIdType sosObject = new PGIVoiceCreate.SosObjectIdType();
    sosObject.ownershipLevel = PGIVoiceCreate.OwnershipLevelType.user;
    sosObject.ownershipLevelSpecified = true;
    sosObject.sosType = "tts";
    sosObject.Value = "tts_insert";
    doc.Item = sosObject;
    exact[0].PromptAttachment = doc;

    //ResponseAttachment
    PGIVoiceCreate.DocumentInfoType Res = new PGICallPreparation.PGIVoiceCreate.DocumentInfoType();
    Res.DocType = "WAV";
    PGIVoiceCreate.DocumentType ResDoc = new PGIVoiceCreate.DocumentType();

    // Setup Document - TTS Template to be used
    PGIVoiceCreate.SosObjectIdType ResSosObject = new PGIVoiceCreate.SosObjectIdType();
    ResSosObject.ownershipLevel = PGIVoiceCreate.OwnershipLevelType.user;
    ResSosObject.ownershipLevelSpecified = true;
    ResSosObject.sosType = "tts";
    ResSosObject.Value = "tts_insert1";
    Res.Item = ResSosObject;
    exact[0].ResponseAttachment = Res;

    MyTrans[0].Item = exact[0];
    trans.Transaction = MyTrans;
    vsc.TransactionInfo = trans;

    PGIVoiceCreate.XOA pc = new PGICallPreparation.PGIVoiceCreate.XOA();
    PGIVoiceCreate.Authentication PCAuthentication = new PGIVoiceCreate.Authentication();
    PGIVoiceCreate.XDDSAuthType XDDSAuth = new PGIVoiceCreate.XDDSAuthType();
    // init Authentication objects            
    XDDSAuth.Password = "Password";
    XDDSAuth.RequesterID = "UserID";
    PCAuthentication.XDDSAuth = XDDSAuth;
    PGIVoiceCreate.Request req = new PGICallPreparation.PGIVoiceCreate.Request();
    PGIVoiceCreate.Response Response = new PGIVoiceCreate.Response();

    pc.Url = "http://xoa.pt.premiereglobal.com/soap/sync";
    req.ReceiverKey = "http://xoa.pt.premiereglobal.com/soap/sync";
    req.Authentication = PCAuthentication;
    req.ResultRequired = PGIVoiceCreate.RequiredType.yes;
    req.ResponseRequiredSpecified = true;

    pc.RequestValue = req;
    pc.ResponseValue = Response;

    PGIVoiceCreate.VoiceScriptCreateResult result = pc.VoiceScriptCreate(vsc);
    if (result != null)
    {
        if (result.Status != null)
        {
        lblResponse.Text = result.Status.StatusCode + ":" + result.Status.StatusMessage;
        }
    }
    else
    {
        MessageBox.Show("Failiure to create voice script");
    }
    }

     

    I have written this code using the VoiceScriptCreate API Manual.

     

    Regars
    Sara

  • Hi Tom,

    I run the code. its executed. but i'm getting the status as Code : 1 and Message : Object name should not be empty. where should i set the object name in my code. Please suggest me.

    Regards
    Sara

  • Hi Tom,

    Thanks for your help, finally i created Voice Script using c# codes.

    Thanks and Regards
    Sara