#define OSP_DEF_DESTINATIONS ((unsigned int)5) /* OSP default max number of destinations */
#define OSP_DEF_TIMELIMIT ((unsigned int)0) /* OSP default duration limit, no limit */
#define OSP_DEF_PROTOCOL OSP_PROT_SIP /* OSP default destination protocol, SIP */
+#define OSP_MAX_CUSTOMINFO ((unsigned int)8) /* OSP max number of custom info */
/* OSP Provider */
struct osp_provider {
* \param snetid Source network ID
* \param np NP parameters
* \param div SIP Diversion header parameters
+ * \param cinfo Custom info
* \param results Lookup results
* \return 1 Found , 0 No route, -1 Error
*/
const char* snetid,
struct osp_npparam* np,
struct osp_diversion* div,
+ const char* cinfo[],
struct osp_results* results)
{
int res;
osp_convert_inout(div->host, host, sizeof(host));
OSPPTransactionSetDiversion(results->outhandle, div->user, host);
+ if (cinfo != NULL) {
+ for (i = 0; i < OSP_MAX_CUSTOMINFO; i++) {
+ if (!ast_strlen_zero(cinfo[i])) {
+ OSPPTransactionSetCustomInfo(results->outhandle, i, cinfo[i]);
+ }
+ }
+ }
+
callidnum = 0;
callids[0] = NULL;
for (i = 0; i < OSP_CALLID_MAXNUM; i++) {
const char* snetid = "";
struct osp_npparam np;
struct osp_diversion div;
+ unsigned int i;
+ const char* cinfo[OSP_MAX_CUSTOMINFO] = { NULL };
char buffer[OSP_TOKSTR_SIZE];
struct osp_results results;
const char* status;
div.user = ast_var_value(current);
} else if (!strcasecmp(ast_var_name(current), "OSPINDIVHOST")) {
div.host = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO1")) {
+ cinfo[0] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO2")) {
+ cinfo[1] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO3")) {
+ cinfo[2] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO4")) {
+ cinfo[3] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO5")) {
+ cinfo[4] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO6")) {
+ cinfo[5] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO7")) {
+ cinfo[6] = ast_var_value(current);
+ } else if (!strcasecmp(ast_var_name(current), "OSPINCUSTOMINFO8")) {
+ cinfo[7] = ast_var_value(current);
}
}
ast_debug(1, "OSPLookup: source device '%s'\n", srcdev);
ast_debug(1, "OSPLookup: OSPINNPDI '%d'\n", np.npdi);
ast_debug(1, "OSPLookup: OSPINDIVUSER '%s'\n", div.user);
ast_debug(1, "OSPLookup: OSPINDIVHOST'%s'\n", div.host);
+ for (i = 0; i < OSP_MAX_CUSTOMINFO; i++) {
+ if (!ast_strlen_zero(cinfo[i])) {
+ ast_debug(1, "OSPLookup: OSPINCUSTOMINFO%d '%s'\n", i, cinfo[i]);
+ }
+ }
if ((cres = ast_autoservice_start(chan)) < 0) {
return -1;
}
- if ((res = osp_lookup(provider, callidtypes, srcdev, chan->cid.cid_num, args.exten, snetid, &np, &div, &results)) > 0) {
+ if ((res = osp_lookup(provider, callidtypes, srcdev, chan->cid.cid_num, args.exten, snetid, &np, &div, cinfo, &results)) > 0) {
status = AST_OSP_SUCCESS;
} else {
results.tech[0] = '\0';