diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 02bafe16742c3a8638a1f70b81ee032051ce2855..4220e82cae3a48488ff4f22dacb414126843409f 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9124,7 +9124,7 @@ static int sip_getheader(struct ast_channel *chan, void *data)
 	}
 
 	ast_mutex_lock(&chan->lock);
-	if (chan->type != type) {
+	if (chan->type != channeltype) {
 		ast_log(LOG_WARNING, "Call this application only on incoming SIP calls\n");
 		ast_mutex_unlock(&chan->lock);
 		return 0;