
Go to the source code of this file.
Functions | |
| int | ast_sip_api_provider_register (const struct ast_sip_api_tech *provider) |
| Register a SIP API provider. | |
| void | ast_sip_api_provider_unregister (void) |
| Unregister a SIP API provider. | |
| int | ast_sipinfo_send (struct ast_channel *chan, struct ast_variable *headers, const char *content_type, const char *content, const char *useragent_filter) |
| Send a customized SIP INFO request. | |
Variables | |
| static struct ast_sip_api_tech * | api_provider |
| int ast_sip_api_provider_register | ( | const struct ast_sip_api_tech * | provider | ) |
Register a SIP API provider.
This will fail if a provider has already registered or if the provider is using an incorrect version.
| provider | The provider to register |
| 0 | Success |
| -1 | Failure |
Definition at line 39 of file sip_api.c.
References ast_log(), AST_SIP_API_VERSION, LOG_WARNING, ast_sip_api_tech::name, and ast_sip_api_tech::version.
Referenced by load_module().
{
if (api_provider) {
ast_log(LOG_WARNING, "SIP provider %s has already registered. Not registering provider %s\n",
api_provider->name, provider->name);
return -1;
}
if (provider->version != AST_SIP_API_VERSION) {
ast_log(LOG_WARNING, "SIP API provider version mismatch: Current version is %d but provider "
"uses version %d\n", AST_SIP_API_VERSION, provider->version);
return -1;
}
api_provider = provider;
return 0;
}
| void ast_sip_api_provider_unregister | ( | void | ) |
Unregister a SIP API provider.
Definition at line 57 of file sip_api.c.
Referenced by load_module(), and unload_module().
{
api_provider = NULL;
}
| int ast_sipinfo_send | ( | struct ast_channel * | chan, |
| struct ast_variable * | headers, | ||
| const char * | content_type, | ||
| const char * | content, | ||
| const char * | useragent_filter | ||
| ) |
Send a customized SIP INFO request.
| headers | The headers to add to the INFO request |
| content_type | The content type header to add |
| conten | The body of the INFO request |
| useragent_filter | If non-NULL, only send the INFO if the recipient's User-Agent contains useragent_filter as a substring |
| 0 | Success |
| non-zero | Failure |
Definition at line 25 of file sip_api.c.
References ast_log(), LOG_WARNING, and ast_sip_api_tech::sipinfo_send.
{
if (!api_provider) {
ast_log(LOG_WARNING, "Unable to send custom SIP INFO. No API provider registered\n");
return -1;
}
return api_provider->sipinfo_send(chan, headers, content_type, content, useragent_filter);
}
struct ast_sip_api_tech* api_provider [static] |