diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 235d71bdef60cac8958837706845220a8d78b8cd..60b03244c78a6875da515f1c75a5aef081fa1281 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -4309,7 +4309,7 @@ ast_callid ast_channel_callid(const struct ast_channel *chan);
 unsigned int ast_channel_sessionId(const struct ast_channel *chan);
 void ast_channel_sessionId_set(struct ast_channel *chan, unsigned int value);
 const char *ast_channel_SIPSessionID(const struct ast_channel *chan);
-void ast_channel_SIPSessionID_set(struct ast_channel *chan, const char *value, size_t size);
+void ast_channel_SIPSessionID_set(struct ast_channel *chan, const char *value);
 const char *ast_channel_sipIpAddress(const struct ast_channel *chan);
 void ast_channel_sipIpAddress_set(struct ast_channel *chan, const char *value, size_t size);
 const char *ast_channel_farEndIPAddress(const struct ast_channel *chan);
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 216e01b6514d367cb047b884db5e539fd43f20fe..f35e4b59b5fcd4e423d99edfa5e44ff19d958b74 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -832,9 +832,9 @@ const char *ast_channel_SIPSessionID(const struct ast_channel *chan)
 {
 	return chan->SIPSessionID;
 }
-void ast_channel_SIPSessionID_set(struct ast_channel *chan, const char *value, size_t size)
+void ast_channel_SIPSessionID_set(struct ast_channel *chan, const char *value)
 {
-	ast_copy_string(chan->SIPSessionID, value, size);
+	ast_copy_string(chan->SIPSessionID, value, sizeof(chan->SIPSessionID));
 }
 
 const char *ast_channel_sipIpAddress(const struct ast_channel *chan)
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index d16d5f6adc607d8ccef4e6f8510a8294504e30ee..e7c1c843d7f16b0c050b031b1e36979b5b849b5e 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -4122,7 +4122,7 @@ end:
 		if (SessionID)
 			ast_copy_pj_str(&value, &SessionID->hvalue, pj_strlen(&SessionID->hvalue) + 1);
 
-		ast_channel_SIPSessionID_set(invite->session->channel, value, 33);
+		ast_channel_SIPSessionID_set(invite->session->channel, value);
 		ast_channel_sessionId_set(invite->session->channel, local->origin.id);
 		ast_channel_sipIpAddress_set(invite->session->channel, pj_strbuf(&local->origin.addr), pj_strlen(&local->origin.addr));
 	}
@@ -4592,7 +4592,7 @@ static void handle_incoming_response(struct ast_sip_session *session, pjsip_rx_d
 			if (SessionID)
 				ast_copy_pj_str(&value, &SessionID->hvalue, pj_strlen(&SessionID->hvalue) + 1);
 
-			ast_channel_SIPSessionID_set(session->channel, value, 33);
+			ast_channel_SIPSessionID_set(session->channel, value);
 		}
 	}