C# Class SIPSorcery.AppServer.DialPlan.DialPlanScriptFacade

Helper functions for use in dial plan scripts.
Afficher le fichier Open project: sipsorcery/sipsorcery Class Usage Examples

Méthodes publiques

Свойство Type Description
LastDialled List
PublicIPAddress IPAddress

Méthodes publiques

Méthode Description
Callback ( string dest1, string dest2 ) : void

See Callback method below.

Callback ( string dest1, string dest2, int delaySeconds ) : void
Callback ( string dest1, string dest2, int delaySeconds, int ringTimeoutLeg1, int ringTimeoutLeg2 ) : void
Callback ( string dest1, string dest2, int delaySeconds, int ringTimeoutLeg1, int ringTimeoutLeg2, string customHeadersCallLeg1, string customHeadersCallLeg2 ) : void
Cleanup ( ) : void
ClearCustomBody ( ) : void

Clears the custom body so that the incoming request body will again be used on forwarded requests.

ClearCustomSIPHeaders ( ) : void

Clears all the custom SIP header values from the list.

ClearFromHeader ( ) : void

Reset the custom From header values so that the corresponding values from the originating request will be used.

CommitTransaction ( ) : void
DBDelete ( string key ) : void
DBDelete ( string dbType, string dbConnStr, string key ) : void
DBExecuteNonQuery ( string dbType, string dbConnStr, string query ) : void
DBExecuteScalar ( string dbType, string dbConnStr, string query ) : string
DBGetKeys ( ) : List
DBRead ( string key ) : string
DBRead ( string dbType, string dbConnStr, string key ) : string
DBReadForUpdate ( string key ) : string
DBWrite ( string key, string value ) : void
DBWrite ( string dbType, string dbConnStr, string key, string value ) : void
Dial ( string data ) : DialPlanAppResult

Attempts to dial a series of forwards and bridges the first one that connects with the client call.

Dial ( string data, int ringTimeout ) : DialPlanAppResult

Attempts to dial a series of forwards and bridges the first one that connects with the client call.

Dial ( string data, int ringTimeout, int answeredCallLimit ) : DialPlanAppResult

Attempts to dial a series of forwards and bridges the first one that connects with the client call.

Dial ( string data, int ringTimeout, int answeredCallLimit, CRMHeaders contact ) : DialPlanAppResult
DialPlanScriptFacade ( SIPTransport sipTransport, DialPlanExecutingScript executingScript, SIPMonitorLogDelegate logDelegate, DialogueBridgeCreatedDelegate createBridge, SIPRequest sipRequest, SIPCallDirection callDirection, DialPlanContext dialPlanContext, GetCanonicalDomainDelegate getCanonicalDomain, ISIPCallManager callManager, SIPSorceryPersistor sipSorceryPersistor, SIPEndPoint outboundProxySocket, DialPlanEngine dialPlanEngine ) : System
DoesSIPAccountExist ( string username ) : bool

Used to check for the existence of a SIP account in the default domain.

DoesSIPAccountExist ( string username, string domain ) : bool

Used to check for the existence of a SIP account in the specified domain.

ENUMLookup ( string number ) : string

Trys an ENUM lookup on the specified number.

Email ( string to, string subject, string body ) : void

Sends an email from the dialplan. There are a number of restrictions put in place and this is a privileged application that users must be manually authorised for.

ExtendScriptTimeout ( int seconds ) : void
GTalk ( string username, string password, string sendToUser, string message ) : void
GTalk ( string username, string password, string sendToUser, string message, int connectionTimeout ) : void

Attempts to send a gTalk IM to the specified account.

GetBalance ( string accountCode ) : decimal

Gets the balance for a customer account record.

GetBindings ( ) : SIPRegistrarBinding[]

Gets an array of the registered contacts for the dialplan owner's SIP account.

GetBindings ( string username, string domain ) : SIPRegistrarBinding[]

Gets an array of the registered contacts for the specified SIP account. Only the owner of the SIP account will be allowed to retrieve a list of bindings for it.

GetCanonicalDomain ( string host ) : string

Allows a hostname to be tested to determine if it is a sipsorcery serviced domain and if it is the canonical domain will be returned.

GetCurrentCallCount ( ) : int

Gets the number of currently active calls for the dial plan owner.

GetCurrentCalls ( ) : List

Gets a list of currently active calls for the dial plan owner.

GetRate ( string rateCode, string destination ) : SIPSorcery.Entities.Rate
GetRate ( string rateCode, string destination, int ratePlan ) : SIPSorcery.Entities.Rate
GetSIPAccounts ( ) : List

Allows a list of all the dialplan owner's SIP accounts to be retrieved.

GetTimezone ( ) : string

Retrieves the timezone setting for the owner of the executing dialplan.

GetTimezoneOffsetMinutes ( ) : int

Retrieves the timezone offset minutes from UTC for the owner of the executing dialplan.

GoogleContactLookup ( string oAuthToken, string lookup ) : string
GoogleContactLookup ( string username, string password, string lookup ) : string
GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber ) : void
GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch ) : void
GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch, int phoneType ) : void
GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch, int phoneType, int waitForCallbackTimeout ) : void
GoogleVoiceSMS ( string emailAddress, string password, string destinationNumber, string message ) : void
IsAvailable ( ) : bool

Checks whether the dialplan owner's default SIP account is online (has any current bindings).

IsAvailable ( string username ) : bool

Checks whether SIP account belonging to the default server domain is online (has any current bindings).

IsAvailable ( string username, string domain ) : bool

Checks whether the specified SIP account is online (has any current bindings).

IsMine ( string username ) : bool

Checks whether the specified SIP account and default domain belongs to the dialplan owner.

IsMine ( string username, string domain ) : bool

Checks whether the specified SIP account belongs to the dialplan owner.

Log ( string message ) : void

Logs a message with the proxy. Typically this records the message in the database and also prints it out on the proxy monitor telnet console.

PrintCustomSIPHeaders ( ) : void

Dumps the currently stored custom SIP headers to the console or monitoring screen to allow users to troubleshoot.

RemoveCustomSIPHeader ( string headerName ) : void

If present removes a SIP header from the list of custom headers.

Respond ( int statusCode, string reason ) : void
Respond ( int statusCode, string reason, string customHeaders ) : void

Sends a SIP response to the client call. If a final response is sent then the client call will hang up.

RollbackTransaction ( ) : void
SendRequest ( string methodStr, string destination, string contentType, string body, int responseTimeoutSeconds ) : void
SendRequest ( string methodStr, string destination, string contentType, string body, int responseTimeoutSeconds, string username, string password ) : void
SetCallerCRMDetails ( CRMHeaders crmHeader ) : void

Sets CRM headers for the dialplan context. Typically the CRM headers will contain extra information about the caller that has been obtained from an external CRM system.

SetCustomContent ( string content ) : void

Sets the custom body that will override the incoming request body for forwarded INVITE requests.

SetCustomContent ( string contentType, string content ) : void

Sets the custom body that will override the incoming request body for forwarded INVITE requests.

SetCustomSIPHeader ( string headerName, string headerValue ) : void

Adds a name value pair to the custom SIP headers list. The custom headers will be added to any forwarded call requests.

SetFromHeader ( string fromName, string fromUser, string fromHost ) : void

Sets the value of part or all of the From header that will be set on forwarded calls. Leaving a part of the header as null will result in the corresponding value from the originating request being used.

StartTransaction ( ) : void
TurnOffAutoCleanup ( ) : void
WebGet ( string url ) : string
WebGet ( string url, int timeout ) : string

Executes a HTTP GET request and if succesful returns up to the first 1024 bytes read from the response to the caller.

WhoAmI ( ) : string

Private Methods

Méthode Description
ApplyENUMRules ( string number, RecordNAPTR naptrRecords ) : string

Applies a set of NAPTR rules obtained from an ENUM lookup to attempt to get a SIP URI. This functionality should be moved closer to the DNS classes once it becomes more mature and universal. See RFC 2915.

CleanupDialPlanScript ( ) : void

A function that gets attached to the executing thread object and that will be called when the dialplan script is complete and immediately prior to a possible thread abortion.

ClientCallTerminated ( CallCancelCause cancelCause ) : void This method will be called on the thread that owns the dialplan context object so it's critical that Thread abort is not called in it or from it.
DBDelete ( StorageTypes storageType, string dbConnStr, string key ) : void
DBRead ( StorageTypes storageType, string dbConnStr, string key, bool forUpdate ) : string
DBWrite ( StorageTypes storageType, string dbConnStr, string key, string value ) : void
Dial ( string data, int ringTimeout, int answeredCallLimit, SIPRequest clientRequest, CRMHeaders contact ) : DialPlanAppResult

DialPlanScriptFacade ( ) : System
FireProxyLogEvent ( SIPMonitorEvent monitorEvent ) : void
FormatForENUMLookup ( string number ) : string

Attempts to put a number into e164 format for an ENUM lookup.

GetDatabaseConnection ( StorageTypes storageType, string dbConnStr ) : IDbConnection
GetStorageType ( string dbType ) : StorageTypes
IsAppAuthorised ( string authorisedApps, string applicationName ) : bool

Used to authorise calls to privileged dialplan applications. For example sending an email requires that the dialplan has the "email" in its list of authorised apps.

SendGoogleAnalyticsEvent ( string category, string action, string label, int value ) : void

Method Details

Callback() public méthode

See Callback method below.
public Callback ( string dest1, string dest2 ) : void
dest1 string
dest2 string
Résultat void

Callback() public méthode

public Callback ( string dest1, string dest2, int delaySeconds ) : void
dest1 string
dest2 string
delaySeconds int
Résultat void

Callback() public méthode

public Callback ( string dest1, string dest2, int delaySeconds, int ringTimeoutLeg1, int ringTimeoutLeg2 ) : void
dest1 string
dest2 string
delaySeconds int
ringTimeoutLeg1 int
ringTimeoutLeg2 int
Résultat void

Callback() public méthode

public Callback ( string dest1, string dest2, int delaySeconds, int ringTimeoutLeg1, int ringTimeoutLeg2, string customHeadersCallLeg1, string customHeadersCallLeg2 ) : void
dest1 string
dest2 string
delaySeconds int
ringTimeoutLeg1 int
ringTimeoutLeg2 int
customHeadersCallLeg1 string
customHeadersCallLeg2 string
Résultat void

Cleanup() public méthode

public Cleanup ( ) : void
Résultat void

ClearCustomBody() public méthode

Clears the custom body so that the incoming request body will again be used on forwarded requests.
public ClearCustomBody ( ) : void
Résultat void

ClearCustomSIPHeaders() public méthode

Clears all the custom SIP header values from the list.
public ClearCustomSIPHeaders ( ) : void
Résultat void

ClearFromHeader() public méthode

Reset the custom From header values so that the corresponding values from the originating request will be used.
public ClearFromHeader ( ) : void
Résultat void

CommitTransaction() public méthode

public CommitTransaction ( ) : void
Résultat void

DBDelete() public méthode

public DBDelete ( string key ) : void
key string
Résultat void

DBDelete() public méthode

public DBDelete ( string dbType, string dbConnStr, string key ) : void
dbType string
dbConnStr string
key string
Résultat void

DBExecuteNonQuery() public méthode

public DBExecuteNonQuery ( string dbType, string dbConnStr, string query ) : void
dbType string
dbConnStr string
query string
Résultat void

DBExecuteScalar() public méthode

public DBExecuteScalar ( string dbType, string dbConnStr, string query ) : string
dbType string
dbConnStr string
query string
Résultat string

DBGetKeys() public méthode

public DBGetKeys ( ) : List
Résultat List

DBRead() public méthode

public DBRead ( string key ) : string
key string
Résultat string

DBRead() public méthode

public DBRead ( string dbType, string dbConnStr, string key ) : string
dbType string
dbConnStr string
key string
Résultat string

DBReadForUpdate() public méthode

public DBReadForUpdate ( string key ) : string
key string
Résultat string

DBWrite() public méthode

public DBWrite ( string key, string value ) : void
key string
value string
Résultat void

DBWrite() public méthode

public DBWrite ( string dbType, string dbConnStr, string key, string value ) : void
dbType string
dbConnStr string
key string
value string
Résultat void

Dial() public méthode

Attempts to dial a series of forwards and bridges the first one that connects with the client call.
public Dial ( string data ) : DialPlanAppResult
data string The dial string containing the list of call legs to attempt to forward the call to.
Résultat DialPlanAppResult

Dial() public méthode

Attempts to dial a series of forwards and bridges the first one that connects with the client call.
public Dial ( string data, int ringTimeout ) : DialPlanAppResult
data string The dial string containing the list of call legs to attempt to forward the call to.
ringTimeout int The period in seconds to perservere with the dial command attempt without a final response before giving up.
Résultat DialPlanAppResult

Dial() public méthode

Attempts to dial a series of forwards and bridges the first one that connects with the client call.
public Dial ( string data, int ringTimeout, int answeredCallLimit ) : DialPlanAppResult
data string The dial string containing the list of call legs to attempt to forward the call to.
ringTimeout int The period in seconds to perservere with the dial command attempt without a final response before giving up.
answeredCallLimit int If greater than 0 this specifies the period in seconds an answered call will be hungup after.
Résultat DialPlanAppResult

Dial() public méthode

public Dial ( string data, int ringTimeout, int answeredCallLimit, CRMHeaders contact ) : DialPlanAppResult
data string
ringTimeout int
answeredCallLimit int
contact CRMHeaders
Résultat DialPlanAppResult

DialPlanScriptFacade() public méthode

public DialPlanScriptFacade ( SIPTransport sipTransport, DialPlanExecutingScript executingScript, SIPMonitorLogDelegate logDelegate, DialogueBridgeCreatedDelegate createBridge, SIPRequest sipRequest, SIPCallDirection callDirection, DialPlanContext dialPlanContext, GetCanonicalDomainDelegate getCanonicalDomain, ISIPCallManager callManager, SIPSorceryPersistor sipSorceryPersistor, SIPEndPoint outboundProxySocket, DialPlanEngine dialPlanEngine ) : System
sipTransport SIPTransport
executingScript DialPlanExecutingScript
logDelegate SIPMonitorLogDelegate
createBridge DialogueBridgeCreatedDelegate
sipRequest SIPRequest
callDirection SIPCallDirection
dialPlanContext DialPlanContext
getCanonicalDomain GetCanonicalDomainDelegate
callManager ISIPCallManager
sipSorceryPersistor SIPSorceryPersistor
outboundProxySocket SIPEndPoint
dialPlanEngine DialPlanEngine
Résultat System

DoesSIPAccountExist() public méthode

Used to check for the existence of a SIP account in the default domain.
public DoesSIPAccountExist ( string username ) : bool
username string The SIP account username to check for.
Résultat bool

DoesSIPAccountExist() public méthode

Used to check for the existence of a SIP account in the specified domain.
public DoesSIPAccountExist ( string username, string domain ) : bool
username string The SIP account username to check for.
domain string The SIP domain to check for the account in.
Résultat bool

ENUMLookup() public méthode

Trys an ENUM lookup on the specified number.
public ENUMLookup ( string number ) : string
number string
Résultat string

Email() public méthode

Sends an email from the dialplan. There are a number of restrictions put in place and this is a privileged application that users must be manually authorised for.
public Email ( string to, string subject, string body ) : void
to string The list of addressees to send the email to. Limited to a maximum of ALLOWED_ADDRESSES_PER_EMAIL.
subject string The email subject. Limited to a maximum length of MAX_EMAIL_SUBJECT_LENGTH.
body string The email body. Limited to a maximum length of MAX_EMAIL_BODY_LENGTH.
Résultat void

ExtendScriptTimeout() public méthode

public ExtendScriptTimeout ( int seconds ) : void
seconds int
Résultat void

GTalk() public méthode

public GTalk ( string username, string password, string sendToUser, string message ) : void
username string
password string
sendToUser string
message string
Résultat void

GTalk() public méthode

Attempts to send a gTalk IM to the specified account.
public GTalk ( string username, string password, string sendToUser, string message, int connectionTimeout ) : void
username string
password string
sendToUser string
message string
connectionTimeout int
Résultat void

GetBalance() public méthode

Gets the balance for a customer account record.
public GetBalance ( string accountCode ) : decimal
accountCode string The account code to get the record for.
Résultat decimal

GetBindings() public méthode

Gets an array of the registered contacts for the dialplan owner's SIP account.
public GetBindings ( ) : SIPRegistrarBinding[]
Résultat SIPRegistrarBinding[]

GetBindings() public méthode

Gets an array of the registered contacts for the specified SIP account. Only the owner of the SIP account will be allowed to retrieve a list of bindings for it.
public GetBindings ( string username, string domain ) : SIPRegistrarBinding[]
username string
domain string
Résultat SIPRegistrarBinding[]

GetCanonicalDomain() public méthode

Allows a hostname to be tested to determine if it is a sipsorcery serviced domain and if it is the canonical domain will be returned.
public GetCanonicalDomain ( string host ) : string
host string The hostname to attempt to retrieve the canonical domain for.
Résultat string

GetCurrentCallCount() public méthode

Gets the number of currently active calls for the dial plan owner.
public GetCurrentCallCount ( ) : int
Résultat int

GetCurrentCalls() public méthode

Gets a list of currently active calls for the dial plan owner.
public GetCurrentCalls ( ) : List
Résultat List

GetRate() public méthode

public GetRate ( string rateCode, string destination ) : SIPSorcery.Entities.Rate
rateCode string
destination string
Résultat SIPSorcery.Entities.Rate

GetRate() public méthode

public GetRate ( string rateCode, string destination, int ratePlan ) : SIPSorcery.Entities.Rate
rateCode string
destination string
ratePlan int
Résultat SIPSorcery.Entities.Rate

GetSIPAccounts() public méthode

Allows a list of all the dialplan owner's SIP accounts to be retrieved.
public GetSIPAccounts ( ) : List
Résultat List

GetTimezone() public méthode

Retrieves the timezone setting for the owner of the executing dialplan.
public GetTimezone ( ) : string
Résultat string

GetTimezoneOffsetMinutes() public méthode

Retrieves the timezone offset minutes from UTC for the owner of the executing dialplan.
public GetTimezoneOffsetMinutes ( ) : int
Résultat int

GoogleContactLookup() public méthode

public GoogleContactLookup ( string oAuthToken, string lookup ) : string
oAuthToken string
lookup string
Résultat string

GoogleContactLookup() public méthode

public GoogleContactLookup ( string username, string password, string lookup ) : string
username string
password string
lookup string
Résultat string

GoogleVoiceCall() public méthode

public GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber ) : void
emailAddress string
password string
forwardingNumber string
destinationNumber string
Résultat void

GoogleVoiceCall() public méthode

public GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch ) : void
emailAddress string
password string
forwardingNumber string
destinationNumber string
fromURIUserToMatch string
Résultat void

GoogleVoiceCall() public méthode

public GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch, int phoneType ) : void
emailAddress string
password string
forwardingNumber string
destinationNumber string
fromURIUserToMatch string
phoneType int
Résultat void

GoogleVoiceCall() public méthode

public GoogleVoiceCall ( string emailAddress, string password, string forwardingNumber, string destinationNumber, string fromURIUserToMatch, int phoneType, int waitForCallbackTimeout ) : void
emailAddress string
password string
forwardingNumber string
destinationNumber string
fromURIUserToMatch string
phoneType int
waitForCallbackTimeout int
Résultat void

GoogleVoiceSMS() public méthode

public GoogleVoiceSMS ( string emailAddress, string password, string destinationNumber, string message ) : void
emailAddress string
password string
destinationNumber string
message string
Résultat void

IsAvailable() public méthode

Checks whether the dialplan owner's default SIP account is online (has any current bindings).
public IsAvailable ( ) : bool
Résultat bool

IsAvailable() public méthode

Checks whether SIP account belonging to the default server domain is online (has any current bindings).
public IsAvailable ( string username ) : bool
username string
Résultat bool

IsAvailable() public méthode

Checks whether the specified SIP account is online (has any current bindings).
public IsAvailable ( string username, string domain ) : bool
username string
domain string
Résultat bool

IsMine() public méthode

Checks whether the specified SIP account and default domain belongs to the dialplan owner.
public IsMine ( string username ) : bool
username string
Résultat bool

IsMine() public méthode

Checks whether the specified SIP account belongs to the dialplan owner.
public IsMine ( string username, string domain ) : bool
username string
domain string
Résultat bool

Log() public méthode

Logs a message with the proxy. Typically this records the message in the database and also prints it out on the proxy monitor telnet console.
public Log ( string message ) : void
message string
Résultat void

PrintCustomSIPHeaders() public méthode

Dumps the currently stored custom SIP headers to the console or monitoring screen to allow users to troubleshoot.
public PrintCustomSIPHeaders ( ) : void
Résultat void

RemoveCustomSIPHeader() public méthode

If present removes a SIP header from the list of custom headers.
public RemoveCustomSIPHeader ( string headerName ) : void
headerName string The name of the SIP header to remove.
Résultat void

Respond() public méthode

public Respond ( int statusCode, string reason ) : void
statusCode int
reason string
Résultat void

Respond() public méthode

Sends a SIP response to the client call. If a final response is sent then the client call will hang up.
public Respond ( int statusCode, string reason, string customHeaders ) : void
statusCode int
reason string
customHeaders string
Résultat void

RollbackTransaction() public méthode

public RollbackTransaction ( ) : void
Résultat void

SendRequest() public méthode

public SendRequest ( string methodStr, string destination, string contentType, string body, int responseTimeoutSeconds ) : void
methodStr string
destination string
contentType string
body string
responseTimeoutSeconds int
Résultat void

SendRequest() public méthode

public SendRequest ( string methodStr, string destination, string contentType, string body, int responseTimeoutSeconds, string username, string password ) : void
methodStr string
destination string
contentType string
body string
responseTimeoutSeconds int
username string
password string
Résultat void

SetCallerCRMDetails() public méthode

Sets CRM headers for the dialplan context. Typically the CRM headers will contain extra information about the caller that has been obtained from an external CRM system.
public SetCallerCRMDetails ( CRMHeaders crmHeader ) : void
crmHeader CRMHeaders
Résultat void

SetCustomContent() public méthode

Sets the custom body that will override the incoming request body for forwarded INVITE requests.
public SetCustomContent ( string content ) : void
content string
Résultat void

SetCustomContent() public méthode

Sets the custom body that will override the incoming request body for forwarded INVITE requests.
public SetCustomContent ( string contentType, string content ) : void
contentType string
content string
Résultat void

SetCustomSIPHeader() public méthode

Adds a name value pair to the custom SIP headers list. The custom headers will be added to any forwarded call requests.
public SetCustomSIPHeader ( string headerName, string headerValue ) : void
headerName string The name of the SIP header to add.
headerValue string The value of the SIP header to add.
Résultat void

SetFromHeader() public méthode

Sets the value of part or all of the From header that will be set on forwarded calls. Leaving a part of the header as null will result in the corresponding value from the originating request being used.
public SetFromHeader ( string fromName, string fromUser, string fromHost ) : void
fromName string The custom From header display name to set.
fromUser string The custom From header URI user value to set.
fromHost string The custom From header URI host value to set.
Résultat void

StartTransaction() public méthode

public StartTransaction ( ) : void
Résultat void

TurnOffAutoCleanup() public méthode

public TurnOffAutoCleanup ( ) : void
Résultat void

WebGet() public méthode

public WebGet ( string url ) : string
url string
Résultat string

WebGet() public méthode

Executes a HTTP GET request and if succesful returns up to the first 1024 bytes read from the response to the caller.
public WebGet ( string url, int timeout ) : string
url string The URL of the server to call.
timeout int
Résultat string

WhoAmI() public méthode

public WhoAmI ( ) : string
Résultat string

Property Details

LastDialled public_oe property

public List LastDialled
Résultat List

PublicIPAddress public_oe static_oe property

public static IPAddress PublicIPAddress
Résultat IPAddress