Writing a Client Application

Setup

The HTTP header

The SOAP header

Setting the URL of the service to be accessed

Objects

RecordingFilter

The RecordingFilter object represents a configuration of recording filter (condition, action, filename etc).

 

Properties

Name of propertyTypeDescription
namestring

Unique filter name. Name of filter may consits of following characters:

  • Latin letters a-z, A-Z
  • Digits 0-9
  • Dash symbol (-)
  • Underscore symbol (_)
  • Space character ( )

Note 1:

Name is case insensitive. Following names are interpreted as the same:

  • filter1
  • Filter1
  • FILTER1

Note 2:

Special name is used for a default filter ("filter_").

Default filter is executed when no other filters match.

priorityint

Priority of filter. Filters with lower values are executed before the ones with higher values.

Note 1:

It is permitted that two and more filters have the same priority, but in this case order of filters' execution is not determined.

Note 2:

Priority can have negative values.

For example, -1.

actionstring

One of following:

  • record - record the call, which matches a condition
  • ignore - ignore the call, which matches a condition
  • rename - rename audio file of the call, which matches a condition. Note, this action is accepted only inside section "OnCallStop"
  • delete - delete audio file as well as record inside database for the call, which matches a condition. Note, this action is accepted only inside section "OnCallStop". This action may be usefull if very short calls (less than 5 seconds) should be automatically deleted.
conditionstring

Expression string, for example:

caller-number = '123'

Note 1:

Condition is ignored for default filter (with name "default_").

filenamestring

Filename format for calls, that match a condition.

For example:

C:\Sales\%{setup-time#%Y%m%d}\%{call-id}.mp3

Note 1:

This is optional parameter. If it is not specified than a default filename format is used (see parameter FileNameFormat inside MiaRec.ini file).

customParameters[]array of RecordingFilterCustomParameter

Optional custom parameters, which are assigned to call.

This can be used for storing custom data, which is used by third-party applications, like CRM.

 

 

 

Example (in C#)

See example of method recordingFilterSave()

 

 

 

See Also

 

RecordingFilterCustomParameter

The RecordingFilterCustomParameter object represents a custom value, which is assigned to a call instance.

This custom value can be used for integration with third-party applications, like CRM, Salesforce Automation, Predictive Dialer etc.

For example, each call record inside database may store Marketing Campaign Id, which is used later to select all calls, that were made for a particular campaign.

 

Properties

Name of propertyTypeDescription
namestring

Unique name of the parameter. Name of parameter may consits of following characters:

  • Latin letters a-z, A-Z
  • Digits 0-9
  • Dash symbol (-)
  • Underscore symbol (_)

Note 1:

Name is case insensitive. Following names are interpreted as the same:

  • param1
  • Param1
  • PARAM1

Note 2:

Following names are reserved and should not be used:

  • action
  • condition
  • filename
  • priority
valuestringValue of the custom parameter.

 

Example (in C#)

See example of method recordingFilterSave()

 

See Also

Methods

getVersion

The getVersion method returns version of MiaRec application.

 

Syntax (in C#)

string getVersion();

 

 

Return Value

If the function succeds, the return boolean TRUE value.

If the function fails, SOAP Exceptions is thrown.

 

 

Example (in C#)

try
{
    string version service.getVersion();
    Console.WriteLine(version)
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

Sample output:

MiaRec(Duxoft) Version(3.0.557) Build(Jul 14 2010, 16:03:09)

 

 

reloadConfig

The reloadConfig method forces MiaRec application to re-read configuration from MiaRec.ini configuration file.

 

Syntax (in C#)

void reloadConfig();

 

 

Return Value

The method doesn't return any value. But may throw SOAP Exception, if execution fails.

 

 

Example (in C#)

try
{
    service.reloadConfig();
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

 

recordingFilterLoad

The recordingFilterLoad method returns recording filter object with specified name.

 

Syntax (in C#)

RecordingFilter recordingFilterLoad(
    string section, 
    string name
);

 

 

Parameters

Name of parameterTypeDescription
sectionstring

Section, from where to load filter. It can be one of following values:

  • OnCallStart
  • OnCallStop
namestring

Unique name of filter inside that section.

Special name "default_" is used for a default filter.

 

 

Return Value

If the function succeds, the return value is the filter objec of type RecordingFilter.

If the function fails, then one of folloiwng SOAP Exceptions is thrown.

 

NotFoundExceptionInvalid section parameter or filter with such name doesn't exist
InvalidParameterExceptionName parameter is empty

 

 

Example (in C#)

try
{
    MiaRec::RecordingFilter filter = service.recordingFilterLoad("OnCallStart", "filter1-");

    Console.WriteLine("name:      " + filter.name);
    Console.WriteLine("filename:  " + filter.filename);
    Console.WriteLine("condition: " + filter.condition);
    Console.WriteLine("action:    " + filter.action);

     MiaRec::RecordingFilterCustomParameter[] parameters = filter.customParameters;
     if (parameters != null)
     {
         for (int j = 0; j < parameters.Length; j++)
         {
             Console.WriteLine(parameters[j].name + ": " + parameters[j].value);
         }
     }
}
catch (FaultException<MiaRec::InvalidParameterException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (FaultException<MiaRec::NotFoundException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

Sample output:

name:      filter1-
filename:  C:\Recordings\call.mp3
condition: caller-number = '123' OR callee-number = '123'
action:     record 
custom1: value1
custom2: value2

 

 

See Also

 

recordingFilterLoadAll

The recordingFilterLoadAll method returns all filters from specified section.

 

Syntax (in C#)

RecordingFilter[] recordingFilterLoadAll(
    string section
);

 

 

Parameters

Name of parameterTypeDescription
sectionstring

Section, from where to load filter. It can be one of following values:

  • OnCallStart
  • OnCallStop

 

 

Return Value

If the function succeds, the return value is an array of RecordingFilter objects.

If the function fails, then one of folloiwng SOAP Exceptions is thrown.

 

NotFoundExceptionInvalid section parameter

 

 

Example (in C#)

try
{
    MiaRec::RecordingFilter[] filters = service.recordingFilterLoadAll("OnCallStart");

    for (int i = 0; i < filters.Length; i++)
    {
       MiaRec::RecordingFilter filter = filters[i];

       Console.WriteLine("Filter #" + i + ":");
       Console.WriteLine("    name:      " + filter.name);
       Console.WriteLine("    filename:  " + filter.filename);
       Console.WriteLine("    condition: " + filter.condition);
       Console.WriteLine("    action:    " + filter.action);

       MiaRec::RecordingFilterCustomParameter[] parameters = filter.customParameters;
       if (parameters != null)
       {
           for (int j = 0; j < parameters.Length; j++)
           {
               Console.WriteLine("    " + parameters[j].name + ": " + parameters[j].value);
           }
       }
    }
}
catch (FaultException<MiaRec::NotFoundException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

Sample output:

Filter #0:
    name:      filter1-
    filename:  
    condition: caller-number = '123' OR callee-number = '123'
    action:    record
Filter #2:
    name:      filter2-
    filename:  
    condition: caller-number = '555' OR callee-number = '555'
    action:    record
Filter #3:
    name:      default_
    filename:  
    condition: 
    action:    ignore

 

 

See Also

 

recordingFilterSave

The recordingFilterSave method creates or replaces the existing recording filter.

 

Syntax (in C#)

bool recordingFilterSave(
    string section, 
    RecordingFilter filter
);

 

 

Parameters

Name of parameterTypeDescription
sectionstring

Section, from where to load filter. It can be one of following values:

  • OnCallStart
  • OnCallStop
filterRecordingFilterRecording filter object, which will be created/edited.

 

 

Return Value

If the function succeds, the return boolean TRUE value.

If the function fails, then one of folloiwng SOAP Exceptions is thrown.

 

NotFoundExceptionInvalid section parameter
InvalidSyntaxException
Syntax of condition is not valid
InvalidParameterExceptionOne of filter options is invalid. For example, name is empty or contains invalid character.

 

Remarks

This method creates/edits recording filter inside MiaRec.ini configuration file.

Method reloadConfig should be executed to apply changes to running MiaRec application.

Otherwise changes will be reloaded only when MiaRec is restarted.

 

Example (in C#)

try
{
    MiaRec::RecordingFilter filter = new MiaRec::RecordingFilter();

    filter.name = "filter2-";
    filter.priority = 0;
    filter.condition = "caller-number LIKE '200%' OR callee-number LIKE '200%'";
    filter.action = "record";

    filter.customParameters = new MiaRec::RecordingFilterCustomParameter[2];
    filter.customParameters[0].name =  "company-name";
    filter.customParameters[0].value = "Google";
    filter.customParameters[1].name =  "person-name";
    filter.customParameters[1].value = "John Smith";
    
    service.recordingFilterSave("OnCallStart", filter);
}
catch (FaultException<MiaRec::InvalidParameterException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (FaultException<MiaRec::InvalidSyntaxException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (FaultException<MiaRec::NotFoundException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

 

 

See Also

 

recordingFilterValidate

The recordingFilterValidate method checks if recording filter's options are valid (for example, if condition expression has valid syntax).

 

Syntax (in C#)

bool recordingFilterSave(
    RecordingFilter filter
);

 

 

Parameters

Name of parameterTypeDescription
filterRecordingFilterRecording filter object, which will be validated

 

 

Return Value

If the function succeds, the return boolean TRUE value.

If the function fails, then one of folloiwng SOAP Exceptions is thrown.

 

InvalidSyntaxException
Syntax of condition is not valid
InvalidParameterExceptionOne of filter options is invalid. For example, name is empty or contains invalid character.

 

 

Example (in C#)

try
{
    MiaRec::RecordingFilter filter = new MiaRec::RecordingFilter();

    filter.name = "filter2-";
    filter.priority = 0;
    filter.condition = "caller-number LIKE '200%' OR callee-number LIKE '200%'";
    filter.action = "record";

    filter.customParameters = new MiaRec::RecordingFilterCustomParameter[2];
    filter.customParameters[0].name =  "company-name";
    filter.customParameters[0].value = "Google";
    filter.customParameters[1].name =  "person-name";
    filter.customParameters[1].value = "John Smith";
    
    service.recordingFilterValidate(filter);
}
catch (FaultException<MiaRec::InvalidParameterException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (FaultException<MiaRec::InvalidSyntaxException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

 

See Also

 

recordingFilterDelete

The recordingFilterDelete method removes filter from MiaRec.ini configuration file.

 

Syntax (in C#)

bool recordingFilterDelete(
    string section, 
    string name
);

 

 

Parameters

Name of parameterTypeDescription
sectionstring

Section, from where to load filter. It can be one of following values:

  • OnCallStart
  • OnCallStop
namestringUnique name of the filter

 

 

Return Value

If the function succeds, the return boolean TRUE value.

If the function fails, then one of folloiwng SOAP Exceptions is thrown.

 

NotFoundExceptionInvalid section parameter or filter with such name doesn't exist
InvalidParameterExceptionName is invalid (empty or contains invalid character)

 

Remarks

This method removes a recording filter from MiaRec.ini configuration file.

Method reloadConfig should be executed to apply changes to running MiaRec application.

Otherwise changes will be reloaded only when MiaRec is restarted.

 

Example (in C#)

try
{
    service.recordingFilterDelete("OnCallStart", "filter1-");
}
catch (FaultException<MiaRec::InvalidParameterException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (FaultException<MiaRec::NotFoundException> ex)
{
    Console.WriteLine("Failed: " + ex.Detail.Description);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message)
}

 

 

See Also

 

Exceptions

InvalidParameterException

The InvalidParameterException exception means that one of method parameters is invalid. See more detailed description inside related method definition.

 

Properties

Name of propertyTypeDescription
DescriptionstringHuman-redable description of the error.

 

 

Example (in C#)

See example of method recordingFilterSave()

 

 

InvalidSyntaxException

The InvalidSyntaxException exception means that syntax of one of method's parameters is invalid. See more detailed description inside related method definition.

 

Properties

Name of propertyTypeDescription
DescriptionstringHuman-redable description of the error.

 

 

Example (in C#)

See example of method recordingFilterSave()

 

 

NotFoundException

The NotFoundException exception means that the requested object cannot be found. See more detailed description inside related method definition.

 

Properties

Name of propertyTypeDescription
DescriptionstringHuman-redable description of the error.

 

 

Example (in C#)

See example of method recordingFilterLoad()