From ef4556479b3727c9aa956d6973d017c90d430cdf Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthony.minessale@gmail.com>
Date: Tue, 4 Apr 2006 17:59:07 +0000
Subject: [PATCH] add inbound/outbound separation to pcre

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1042 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/dialplans/mod_pcre/mod_pcre.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mod/dialplans/mod_pcre/mod_pcre.c b/src/mod/dialplans/mod_pcre/mod_pcre.c
index 58d94311cc..81b3b3f1d2 100644
--- a/src/mod/dialplans/mod_pcre/mod_pcre.c
+++ b/src/mod/dialplans/mod_pcre/mod_pcre.c
@@ -56,6 +56,7 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
 	pcre *re = NULL;
 	int match_count = 0;
 	int ovector[30];
+	int skip = 0;
 
 	channel = switch_core_session_get_channel(session);
 	caller_profile = switch_channel_get_caller_profile(channel);
@@ -75,6 +76,17 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
 			exten_name = cfg.category;
 			cleanre();
 			match_count = 0;
+			skip = 0;
+
+			if (!strcasecmp(exten_name, "outbound") && !switch_channel_test_flag(channel, CF_OUTBOUND)) {
+				skip = 1;
+			} else if (!strcasecmp(exten_name, "inbound") && switch_channel_test_flag(channel, CF_OUTBOUND)) {
+				skip = 1;
+			}
+		}
+
+		if (skip) {
+			continue;
 		}
 
 		if (!strcasecmp(var, "regex")) {