CTextMessage::GetProvider Method  
 
BOOL GetProvider(
  LPCTSTR lpszPhoneNumber,  
  LPSMSPROVIDER lpProvider  
);
BOOL GetProvider(
  LPCTSTR lpszPhoneNumber,  
  LPTSTR lpszProvider,  
  INT nMaxLength  
);
BOOL GetProvider(
  LPCTSTR lpszPhoneNumber,  
  CString& strProvider  
);

The GetProvider method returns information about the service provider for the specified phone number.

Parameters

lpszPhoneNumber
A pointer to a string which specifies the telephone number that you wish to obtain information about. Any whitespace, punctuation or other non-numeric characters in the string will be ignored. This parameter cannot be NULL.
lpProvider
A pointer to an SMSPROVIDER structure that will contain information about the service provider for the specified phone number.
lpszProvider
A pointer to a string that will contain the name of the wireless service provider associated with the specified phone number when the method returns. If MFC or ATL is being used, an alternate version of this function will return the address in a CString type variable.
nMaxLength
An integer value that specifies the maximum number of characters that can be copied into the string.

Return Value

If the method succeeds and relaying is enabled, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetProvider method returns information about the service provider associated with a phone number. This is done by sending an query to a server that will check the phone number against a database of known providers and the phone numbers that have been allocated for wireless devices. If the phone number is valid, information will be returned about the provider that is responsible for that number.

Because most wireless carriers in the United States and Canada must provide for wireless number portability, there is the possibility that the provider information returned may no longer correspond to the telephone number. It is recommended that you provide your end-user with the ability to specify an alternate preferred provider to use when sending the text message. For more information, refer to the GetGateway method.

This method sends an HTTP query to the server api.sockettools.com to obtain information about the wireless service provider. This requires that the local system can establish a standard network connection over port 80. If the client cannot connect to the server, the method will fail and an appropriate error will be returned. The server imposes a limit on the maximum number of connections that can be established and the maximum number of requests that can be issued per minute. If this method is called multiple times over a short period, the library may also force the application to block briefly. Server responses are cached per session, so calling this method multiple times using the same phone number will not increase the request count.

For a list of all supported wireless service providers, use the EnumProviders method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cstxtv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

EnumProviders, GetGateway, SMSPROVIDER