diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 280a5cb263b9d12a236090ba6409d30704faff21..cea4c1c0a15608113513f8b1d1824c98b5e2c0db 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -4403,7 +4403,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 c42330e9516f50d45c514ba085d22cb22facceb9..98191e597c3ac854dff2e1a31c772a27db7361c3 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -814,9 +814,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 1ad93b7277fd69f2282b617af3ecb35ad494d63c..1f69f3de65c060f4169240cff008010a4cf5f17f 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -4124,7 +4124,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));
 	}
@@ -4581,7 +4581,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);
 		}
 	}