Click or drag to resize
ZenophSMSsetDefaultDialCode Method
Sets the default international dial code to be used for phone numbers not in international format.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
Syntax
public void setDefaultDialCode(
	string dialcode
)

Parameters

dialcode
Type: SystemString
The default international dial code to be set for phone numbers not in international format.
Exceptions
ExceptionCondition
Exception Thrown if the specified dial code is invalid or when it does not exist in user routes.
Remarks

The default international dial code is used when phone numbers being added to the destinations list are not given in international format but rather in local format. This is prepended to phone numbers specified without international dial codes.

On successful authentication, the default dial code for a user account is always loaded and set when using the SMS API. When adding phone numbers not given in international format but which uses a different international dial codes, you must first make a call to this method and specify the international dial code to use for subsequent phone numbers without international dial code.

The international dial code that you set must be one that has already been activated for your account otherwise an Exception will be thrown. As an example, consider the following:

It must be emphasised that international dial codes set with this method are temporal and do not overwrite the default international dial code set for user account. They are used only for the current session when using the SMS API. On every successful authentication, the default international dial code set for a user account is loaded into memory and used until it is overwritten with a call to this method.

Examples
ZenophSMS sms = new ZenophSMS();
sms.setUser("account_login");
sms.setPassword("account_password");
sms.authenticate();

/*
 * Suppose the default international dial code for the account is 233 (ie., Ghana),
 * and we want to add phone numbers not in international format.
 * The default international dial code for the account will be used.
 */
sms.addRecipient("0207xxxxxx");    // becomes 233207xxxxx
sms.addRecipient("0208xxxxxx");    // becomes 233208xxxxx

/*
 * Now, assume we want to add destinations to Nigeria which uses 234 as the international
 * dial code but the phone numbers we are reading from file or some input source
 * are not in international format, then we will have to change the default dial code to
 * 234 to indicate that they will be sent to different country, (in this case Nigeria).
 */
sms.setDefaultDialCode("234");   // could also be +234 or 00234

// now we can read or add phone numbers not in international format.
sms.addRecipient("0805xxxxxx");           // becomes 234805xxxxxx
sms.extractPhoneNumbers("inputsource");   // will use 234 as dial code for phone numbers not in international format
See Also