SIP API Developer's Guide

SIP ID Generating Functions

char *sip_branchid(sip_msg_t sip_msg);

The *sip_branchid() function returns a randomly generated string for the branch parameter in a VIA header. This function prefixes the string with the string z9hG4bK to meet the requirements of RFC 3261. If the value of the sip_msg parameter is a valid SIP message, this function constructs the branch ID by using an MD5 hash of the VIA, TO, FROM, CALL-ID, CSeq, and Request URI headers. If the value of the sip_msg parameter is NULL, this function returns a random string that is prefixed with the string z9hG4bK. The calling thread must free the string that this function returns.

char *sip_guid();

The *sip_guid() function returns a randomly generated string. The calling thread must free the string that this function returns.

uint32_t sip_get_cseq();

The sip_get_cseq() function returns the most significant 31 bits returned by the time(2) system call. You can use this value as the initial sequence number.