# SIP address parser API.

## Typedefs
typedef struct SalAddress | LinphoneAddress
## Functions
LinphoneAddress * | linphone_address_new (const char *addr)
LinphoneAddress * | linphone_address_clone (const LinphoneAddress *addr)
const char * | linphone_address_get_scheme (const LinphoneAddress *u)
const char * | linphone_address_get_display_name (const LinphoneAddress *u)
const char * | linphone_address_get_username (const LinphoneAddress *u)
const char * | linphone_address_get_domain (const LinphoneAddress *u)
void | linphone_address_set_display_name (LinphoneAddress *u, const char *display_name)
void | linphone_address_set_username (LinphoneAddress *uri, const char *username)
void | linphone_address_set_domain (LinphoneAddress *uri, const char *host)
void | linphone_address_set_port (LinphoneAddress *uri, const char *port)
void | linphone_address_set_port_int (LinphoneAddress *uri, int port)
void | linphone_address_clean (LinphoneAddress *uri)
char * | linphone_address_as_string (const LinphoneAddress *u)
char * | linphone_address_as_string_uri_only (const LinphoneAddress *u)
bool_t | linphone_address_weak_equal (const LinphoneAddress *a1, const LinphoneAddress *a2)
void | linphone_address_destroy (LinphoneAddress *u)
int | linphone_address_get_port_int (const LinphoneAddress *u)
const char * | linphone_address_get_port (const LinphoneAddress *u)

## Detailed Description

This api is useful for manipulating SIP addresses ('from' or 'to' headers).

## Typedef Documentation

LinphoneAddress

Object that represents a SIP address.

The LinphoneAddress is an opaque object to represents SIP addresses, ie the content of SIP's 'from' and 'to' headers. A SIP address is made of display name, username, domain name, port, and various uri headers (such as tags). It looks like 'Alice <sip:alice@example.net>'. The LinphoneAddress has methods to extract and manipulate all parts of the address. When some part of the address (for example the username) is empty, the accessor methods return NULL.

## Function Documentation

LinphoneAddress* linphone_address_new | ( | const char * | addr | ) |

Constructs a LinphoneAddress object by parsing the user supplied address, given as a string.

LinphoneAddress* linphone_address_clone | ( | const LinphoneAddress * | addr | ) |

Clones a LinphoneAddress object.

const char* linphone_address_get_scheme | ( | const LinphoneAddress * | u | ) |

Returns the address scheme, normally "sip".

const char* linphone_address_get_display_name | ( | const LinphoneAddress * | u | ) |

Returns the display name.

const char* linphone_address_get_username | ( | const LinphoneAddress * | u | ) |

Returns the username.

const char* linphone_address_get_domain | ( | const LinphoneAddress * | u | ) |

Returns the domain name.

void linphone_address_set_display_name | ( | LinphoneAddress * | u,
|  | const char * | display_name |
| ) |  |  |

Sets the display name.

void linphone_address_set_username | ( | LinphoneAddress * | uri,
|  | const char * | username |
| ) |  |  |

Sets the username.

void linphone_address_set_domain | ( | LinphoneAddress * | uri,
|  | const char * | host |
| ) |  |  |

Sets the domain.

void linphone_address_set_port | ( | LinphoneAddress * | uri,
|  | const char * | port |
| ) |  |  |

Sets the port number.

void linphone_address_set_port_int | ( | LinphoneAddress * | uri,
|  | int | port |
| ) |  |  |

Sets the port number.

void linphone_address_clean | ( | LinphoneAddress * | uri | ) |

Removes address's tags and uri headers so that it is displayable to the user.

char* linphone_address_as_string | ( | const LinphoneAddress * | u | ) |

Returns the address as a string. The returned char * must be freed by the application. Use ms_free().

char* linphone_address_as_string_uri_only | ( | const LinphoneAddress * | u | ) |

Returns the SIP uri only as a string, that is display name is removed. The returned char * must be freed by the application. Use ms_free().

bool_t linphone_address_weak_equal | ( | const LinphoneAddress * | a1,
|  | const LinphoneAddress * | a2 |
| ) |  |  |

Compare two LinphoneAddress ignoring tags and headers, basically just domain, username, and port. Returns TRUE if they are equal.

void linphone_address_destroy | ( | LinphoneAddress * | u | ) |

Destroys a LinphoneAddress object.

int linphone_address_get_port_int | ( | const LinphoneAddress * | u | ) |

Get port number as an integer value.

const char* linphone_address_get_port | ( | const LinphoneAddress * | u | ) |

Get port number, null if not present.