PortSIP VoIP SDK Manual for iOS  16.2
PortSIP features our newest, supported, quality-assured VoIP SDK used by Several hundred companies around the world for easy VoIP application develop and quality-assured code.
Functions
Access SIP message header functions

Functions

(NSString *) - PortSIPSDK::getSipMessageHeaderValue:headerName:
 Access the SIP header of SIP message. More...
 
(long) - PortSIPSDK::addSipMessageHeader:methodName:msgType:headerName:headerValue:
 Add the SIP Message header into the specified outgoing SIP message. More...
 
(int) - PortSIPSDK::removeAddedSipMessageHeader:
 Remove the headers (custom header) added by addSipMessageHeader. More...
 
(void) - PortSIPSDK::clearAddedSipMessageHeaders
 Clear the added extension headers (custom headers) More...
 
(long) - PortSIPSDK::modifySipMessageHeader:methodName:msgType:headerName:headerValue:
 Modify the special SIP header value for every outgoing SIP message. More...
 
(int) - PortSIPSDK::removeModifiedSipMessageHeader:
 Remove the extension header (custom header) from every outgoing SIP message. More...
 
(void) - PortSIPSDK::clearModifiedSipMessageHeaders
 Clear the modified headers value, and do not modify every outgoing SIP message header values any longer. More...
 

Detailed Description

Function Documentation

◆ getSipMessageHeaderValue:headerName:()

- (NSString*) getSipMessageHeaderValue: (NSString *)  sipMessage
headerName: (NSString *)  headerName 

Access the SIP header of SIP message.

Parameters
sipMessageThe SIP message.
headerNameThe header with which to access the SIP message.
Returns
If the function succeeds, it will return value headerValue. If the function fails, it will return value null.
Remarks
When receiving an SIP message in the onReceivedSignaling callback event, and user wishes to get SIP message header value, use getExtensionHeaderValue:
NSString* headerValue = [myVoIPSdk getSipMessageHeaderValue:message headerName:name];

◆ addSipMessageHeader:methodName:msgType:headerName:headerValue:()

- (long) addSipMessageHeader: (long)  sessionId
methodName: (NSString *)  methodName
msgType: (int)  msgType
headerName: (NSString *)  headerName
headerValue: (NSString *)  headerValue 

Add the SIP Message header into the specified outgoing SIP message.

Parameters
sessionIdAdd the header to the SIP message with the specified session Id only. By setting to -1, it will be added to all messages.
methodNameJust add the header to the SIP message with specified method name. For example: "INVITE", "REGISTER", "INFO" etc. If "ALL" specified, it will add all SIP messages.
msgType1 refers to apply to the request message, 2 refers to apply to the response message, 3 refers to apply to both request and response.
headerNameThe header name that will appear in SIP message.
headerValueThe custom header value.
Returns
If the function succeeds, it will return addedSipMessageId, which is greater than 0. If the function fails, it will return a specific error code.

◆ removeAddedSipMessageHeader:()

- (int) removeAddedSipMessageHeader: (long)  addedSipMessageId

Remove the headers (custom header) added by addSipMessageHeader.

Parameters
addedSipMessageIdThe addedSipMessageId return by addSipMessageHeader.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ clearAddedSipMessageHeaders()

- (void) clearAddedSipMessageHeaders

Clear the added extension headers (custom headers)

Remarks
For example, we have added two custom headers into every outgoing SIP message and wish to remove them.
[myVoIPSdk addedSipMessageId:-1 methodName:@"ALL" msgType:3 headerName:@"Blling" headerValue:@"usd100.00"];
[myVoIPSdk addedSipMessageId:-1 methodName:@"ALL" msgType:3 headerName:@"ServiceId" headerValue:@"8873456"];

◆ modifySipMessageHeader:methodName:msgType:headerName:headerValue:()

- (long) modifySipMessageHeader: (long)  sessionId
methodName: (NSString *)  methodName
msgType: (int)  msgType
headerName: (NSString *)  headerName
headerValue: (NSString *)  headerValue 

Modify the special SIP header value for every outgoing SIP message.

Parameters
sessionIdThe header to the SIP message with the specified session Id. By setting to -1, it will be added to all messages.
methodNameModify the header to the SIP message with specified method name only. For example: "INVITE", "REGISTER", "INFO" etc. If "ALL" specified, it will add all SIP messages.
msgType1 refers to apply to the request message, 2 refers to apply to the response message, 3 refers to apply to both request and response.
headerNameThe SIP header name of which the value will be modified.
headerValueThe heaver value to be modified.
Returns
If the function succeeds, it will return modifiedSipMessageId, which is greater than 0. If the function fails, it will return a specific error code.

◆ removeModifiedSipMessageHeader:()

- (int) removeModifiedSipMessageHeader: (long)  modifiedSipMessageId

Remove the extension header (custom header) from every outgoing SIP message.

Parameters
modifiedSipMessageIdThe modifiedSipMessageId is returned by modifySipMessageHeader.
Returns
If the function succeeds, it will return value 0. If the function fails, it will return a specific error code.

◆ clearModifiedSipMessageHeaders()

- (void) clearModifiedSipMessageHeaders

Clear the modified headers value, and do not modify every outgoing SIP message header values any longer.

Remarks
For example, to modify two headers' value for every outging SIP message and wish to clear it:
[myVoIPSdk removeModifiedSipMessageHeader:-1 methodName:@"ALL" msgType:3 headerName:@"Expires" headerValue:@"1000"];
[myVoIPSdk removeModifiedSipMessageHeader:-1 methodName:@"ALL" msgType:3 headerName:@"User-Agent" headerValue:@"MyTest Softphone 1.0"];